#figure 1: plot of coefficients for cultural conservatism main effect


cultmaineffects <- 
  structure(list(
    estimate  = c(auscultb, cancultb, fincultb, fracultb, gercultb, gbcultb, itacultb, nthcultb, nzcultb, norcultb, spncultb, swecultb, swicultb, uscultb, abuscultest, abcancultest, abus19cultest), 
    lower = c(auscultlower, cancultlower, fincultlower, fracultlower, gercultlower, gbcultlower, itacultlower, nthcultlower, nzcultlower, norcultlower, spncultlower, swecultlower, swicultlower, uscultlower, abuscultlower, abcancultlower, abus19cultlower),
    upper = c(auscultupper, cancultupper, fincultupper, fracultupper, gercultupper, gbcultupper, itacultupper, nthcultupper, nzcultupper, norcultupper, spncultupper, swecultupper, swicultupper, uscultupper, abuscultupper, abcancultupper, abus19cultupper)),
    .Names = c("estimate", "lower", "upper"), 
    row.names = c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States", "LAPOP U.S.-2017", "LAPOP Canada-2017", "LAPOP U.S.-2019"), 
    class = "data.frame")



library(ggplot2)

cultmaineffects$source <-  rownames(cultmaineffects)
cultmaineffects$source <-  factor(cultmaineffects$source,levels=rev(cultmaineffects$source))

ggplot(cultmaineffects,aes(x=source,y=estimate))+geom_pointrange(aes(ymin=lower,ymax=upper),shape=15)+ggtitle("Figure 1: Effect of Cultural Conservatism on Openness to Authoritarian Governance",)+coord_flip()+ylim(c(0,.2))+theme_bw()+theme(plot.title = element_text(size = 10))+xlab("")+ylab("")+theme(plot.title = element_text(hjust = 0.5))+geom_hline(yintercept=0,alpha=.5,lty=2)

#describing effects of cultural conservatism and some control variables

#from model 1
mean(cultmaineffects$estimate)
range(cultmaineffects$estimate)

#from model 3
cultmaineffects3<-c(auscultb3, cancultb3, fincultb3, fracultb3, gercultb3, gbcultb3, itacultb3, nthcultb3, nzcultb3, norcultb3, spncultb3, swecultb3, swicultb3, uscultb3, abuscultb3, abcancultb3, abus19cultb3)

mean(cultmaineffects3)


polengmaineffects3<-c(auspolengb3, canpolengb3, finpolengb3, frapolengb3, gerpolengb3, gbpolengb3, itapolengb3, nthpolengb3, nzpolengb3, norpolengb3, spnpolengb3, swepolengb3, swipolengb3, uspolengb3, abuspolengb3, abcanpolengb3, abus19polengb3)

mean(polengmaineffects3)


collegemaineffects3<-c(auscollegeb3, cancollegeb3, fincollegeb3, fracollegeb3, gercollegeb3, gbcollegeb3, itacollegeb3, nthcollegeb3, nzcollegeb3, norcollegeb3, spncollegeb3, swecollegeb3, swicollegeb3, uscollegeb3, abuscollegeb3, abcancollegeb3, abus19collegeb3)

mean(collegemaineffects3)


agemaineffects3<-c(ausageb3, canageb3, finageb3, fraageb3, gerageb3, gbageb3, itaageb3, nthageb3, nzageb3, norageb3, spnageb3, sweageb3, swiageb3, usageb3, abusageb3, abcanageb3, abus19ageb3)

mean(agemaineffects3)


confinstitmaineffects3<-c(ausconfinstitb3, canconfinstitb3, finconfinstitb3, fraconfinstitb3, gerconfinstitb3, gbconfinstitb3, itaconfinstitb3, nthconfinstitb3, nzconfinstitb3, norconfinstitb3, spnconfinstitb3, sweconfinstitb3, swiconfinstitb3, usconfinstitb3, abusconfinstitb3, abcanconfinstitb3, abus19confinstitb3)

mean(confinstitmaineffects3)


#figure 2: plot of coefficients for left economic attitudes main effect

econmaineffects <- 
  structure(list(
    estimate  = c(auseconb, caneconb, fineconb, fraeconb, gereconb, gbeconb, itaeconb, ntheconb, nzeconb, noreconb, spneconb, sweeconb, swieconb, useconb, abuseconest, abcaneconest, abus19econest), 
    lower = c(auseconlower, caneconlower, fineconlower, fraeconlower, gereconlower, gbeconlower, itaeconlower, ntheconlower, nzeconlower, noreconlower, spneconlower, sweeconlower, swieconlower, useconlower, abuseconlower, abcaneconlower, abus19econlower),
    upper = c(auseconupper, caneconupper, fineconupper, fraeconupper, gereconupper, gbeconupper, itaeconupper, ntheconupper, nzeconupper, noreconupper, spneconupper, sweeconupper, swieconupper, useconupper, abuseconupper, abcaneconupper, abus19econupper)),
    .Names = c("estimate", "lower", "upper"), 
    row.names = c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States", "LAPOP U.S.-2017", "LAPOP Canada-2017", "LAPOP U.S.-2019"), 
    class = "data.frame")



econmaineffects$source <-  rownames(econmaineffects)
econmaineffects$source <-  factor(econmaineffects$source,levels=rev(econmaineffects$source))

ggplot(econmaineffects,aes(x=source,y=estimate))+geom_pointrange(aes(ymin=lower,ymax=upper),shape=15)+ggtitle("Figure 2: Effect of Left Economic Attitudes on Openness to Authoritarian Governance",)+coord_flip()+ylim(c(-.1,.2))+theme_bw()+theme(plot.title = element_text(size = 10))+xlab("")+ylab("")+theme(plot.title = element_text(hjust = 0.5))+geom_hline(yintercept=0,alpha=.5,lty=2)



mean(econmaineffects$estimate)
range(econmaineffects$estimate)

#figure 3: plot of coefficients for cultural x economic interaction effect

cultxeconints <- 
  structure(list(
    estimate  = c(ausintb, canintb, finintb, fraintb, gerintb, gbintb, itaintb, nthintb, nzintb, norintb, spnintb, sweintb, swiintb, usintb, abusintest, abcanintest, abus19intest), 
    lower = c(ausintlower, canintlower, finintlower, fraintlower, gerintlower, gbintlower, itaintlower, nthintlower, nzintlower, norintlower, spnintlower, sweintlower, swiintlower, usintlower, abusintlower, abcanintlower, abus19intlower),
    upper = c(ausintupper, canintupper, finintupper, fraintupper, gerintupper, gbintupper, itaintupper, nthintupper, nzintupper, norintupper, spnintupper, sweintupper, swiintupper, usintupper, abusintupper, abcanintupper, abus19intupper)),
    .Names = c("estimate", "lower", "upper"), 
    row.names = c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States", "LAPOP U.S.-2017", "LAPOP Canada-2017", "LAPOP U.S.-2019"), 
    class = "data.frame")

cultxeconints$source <-  rownames(cultxeconints)
cultxeconints$source <-  factor(cultxeconints$source,levels=rev(cultxeconints$source))

ggplot(cultxeconints,aes(x=source,y=estimate))+geom_pointrange(aes(ymin=lower,ymax=upper),shape=15)+ggtitle("Figure 3: Effect of Cultural Conservatism X Left Economic Attitude Interaction on \n Openness to Authoritarian Governance",)+coord_flip()+ylim(c(-.10,.2))+theme_bw()+theme(plot.title = element_text(size = 10))+xlab("")+ylab("")+theme(plot.title = element_text(hjust = 0.5))+geom_hline(yintercept=0,alpha=.5,lty=2)



mean(cultxeconints$estimate)
range(cultxeconints$estimate)

#figure 4: plotting predicted values of openness to auth governance.

authright <- 
  structure(list(
    estimate  = c(ausrightest, canrightest, finrightest, frarightest, gerrightest, gbrightest, itarightest, nthrightest, nzrightest, norrightest, spnrightest, swerightest, swirightest, usrightest, abusrightest, abcanrightest, abus19rightest), 
    lower = c(ausrightlower, canrightlower, finrightlower, frarightlower, gerrightlower, gbrightlower, itarightlower, nthrightlower, nzrightlower, norrightlower, spnrightlower, swerightlower, swirightlower, usrightlower, abusrightlower, abcanrightlower, abus19rightlower),
    upper = c(ausrightupper, canrightupper, finrightupper, frarightupper, gerrightupper, gbrightupper, itarightupper, nthrightupper, nzrightupper, norrightupper, spnrightupper, swerightupper, swirightupper, usrightupper, abusrightupper, abcanrightupper, abus19rightupper)),
    .Names = c("estimate", "lower", "upper"), 
    row.names = c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States", "LAPOP U.S.-2017", "LAPOP Canada-2017", "LAPOP U.S.-2019"), 
    class = "data.frame")


authleft <- 
  structure(list(
    estimate  = c(ausleftest, canleftest, finleftest, fraleftest, gerleftest, gbleftest, italeftest, nthleftest, nzleftest, norleftest, spnleftest, sweleftest, swileftest, usleftest, abusleftest, abcanleftest, abus19leftest), 
    lower = c(ausleftlower, canleftlower, finleftlower, fraleftlower, gerleftlower, gbleftlower, italeftlower, nthleftlower, nzleftlower, norleftlower, spnleftlower, sweleftlower, swileftlower, usleftlower, abusleftlower, abcanleftlower, abus19leftlower),
    upper = c(ausleftupper, canleftupper, finleftupper, fraleftupper, gerleftupper, gbleftupper, italeftupper, nthleftupper, nzleftupper, norleftupper, spnleftupper, sweleftupper, swileftupper, usleftupper, abusleftupper, abcanleftupper, abus19leftupper)),
    .Names = c("estimate", "lower", "upper"), 
    row.names = c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States", "LAPOP U.S.-2017", "LAPOP Canada-2017", "LAPOP U.S.-2019"), 
    class = "data.frame")


authprot <- 
  structure(list(
    estimate  = c(ausprotest, canprotest, finprotest, fraprotest, gerprotest, gbprotest, itaprotest, nthprotest, nzprotest, norprotest, spnprotest, sweprotest, swiprotest, usprotest, abusprotest, abcanprotest, abus19protest), 
    lower = c(ausprotlower, canprotlower, finprotlower, fraprotlower, gerprotlower, gbprotlower, itaprotlower, nthprotlower, nzprotlower, norprotlower, spnprotlower, sweprotlower, swiprotlower, usprotlower, abusprotlower, abcanprotlower, abus19protlower),
    upper = c(ausprotupper, canprotupper, finprotupper, fraprotupper, gerprotupper, gbprotupper, itaprotupper, nthprotupper, nzprotupper, norprotupper, spnprotupper, sweprotupper, swiprotupper, usprotupper, abusprotupper, abcanprotupper, abus19protupper)),
    .Names = c("estimate", "lower", "upper"), 
    row.names = c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States", "LAPOP U.S.-2017", "LAPOP Canada-2017", "LAPOP U.S.-2019"), 
    class = "data.frame")



authfree <- 
  structure(list(
    estimate  = c(ausfreeest, canfreeest, finfreeest, frafreeest, gerfreeest, gbfreeest, itafreeest, nthfreeest, nzfreeest, norfreeest, spnfreeest, swefreeest, swifreeest, usfreeest, abusfreeest, abcanfreeest, abus19freeest), 
    lower = c(ausfreelower, canfreelower, finfreelower, frafreelower, gerfreelower, gbfreelower, itafreelower, nthfreelower, nzfreelower, norfreelower, spnfreelower, swefreelower, swifreelower, usfreelower, abusfreelower, abcanfreelower, abus19freelower),
    upper = c(ausfreeupper, canfreeupper, finfreeupper, frafreeupper, gerfreeupper, gbfreeupper, itafreeupper, nthfreeupper, nzfreeupper, norfreeupper, spnfreeupper, swefreeupper, swifreeupper, usfreeupper, abusfreeupper, abcanfreeupper, abus19freeupper)),
    .Names = c("estimate", "lower", "upper"), 
    row.names = c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States", "LAPOP U.S.-2017", "LAPOP Canada-2017", "LAPOP U.S.-2019"), 
    class = "data.frame")



authfree$source <- rownames(authfree)
authfree$type="Freedom"
authleft$source <- rownames(authleft)
authleft$type="Left"
authright$source <- rownames(authright)
authright$type="Right"
authprot$source <- rownames(authprot)
authprot$type = "Protection"

forplot <- rbind(authfree,authleft,authright,authprot)
forplot$type <- factor(forplot$type,levels=c("Right","Left","Protection","Freedom"))
forplot$source <-  factor(forplot$source,levels=rev(cultxeconints$source))

ggplot(forplot,aes(y=source,x=estimate,shape=type))+geom_point(size=2)+geom_errorbarh(aes(xmin=lower,xmax=upper),height=0)+ggtitle("Figure 4: Predicted Values of Openness to Authoritarian Governance",)+xlim(c(0,.45))+theme_bw()+theme(plot.title = element_text(size = 10))+xlab("")+ylab("")+theme(plot.title = element_text(hjust = 0.5),legend.title = element_blank())+geom_hline(yintercept=0,alpha=.5,lty=2)+theme(legend.position="top")+guides(shape = guide_legend(override.aes = list(size=3))) 


#Figures using 4-item authgov measure in WVS, for ancillary analyses Part E of SOM

#figure E1: plot of coefficients for cultural conservatism main effect


cultmaineffects4 <- 
  structure(list(
    estimate  = c(aus4cultb, can4cultb, fin4cultb, fra4cultb, ger4cultb, gb4cultb, ita4cultb, nth4cultb, nz4cultb, nor4cultb, spn4cultb, swe4cultb, swi4cultb, us4cultb), 
    lower = c(aus4cultlower, can4cultlower, fin4cultlower, fra4cultlower, ger4cultlower, gb4cultlower, ita4cultlower, nth4cultlower, nz4cultlower, nor4cultlower, spn4cultlower, swe4cultlower, swi4cultlower, us4cultlower),
    upper = c(aus4cultupper, can4cultupper, fin4cultupper, fra4cultupper, ger4cultupper, gb4cultupper, ita4cultupper, nth4cultupper, nz4cultupper, nor4cultupper, spn4cultupper, swe4cultupper, swi4cultupper, us4cultupper)),
    .Names = c("estimate", "lower", "upper"), 
    row.names = c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States"), 
    class = "data.frame")



library(ggplot2)

cultmaineffects4$source <-  rownames(cultmaineffects4)
cultmaineffects4$source <-  factor(cultmaineffects4$source,levels=rev(cultmaineffects4$source))

ggplot(cultmaineffects4,aes(x=source,y=estimate))+geom_pointrange(aes(ymin=lower,ymax=upper),shape=15)+ggtitle("Figure E-1: Effect of Cultural Conservatism on 4-Item Openness to Authoritarian Governance",)+coord_flip()+ylim(c(0,.2))+theme_bw()+theme(plot.title = element_text(size = 10))+xlab("")+ylab("")+theme(plot.title = element_text(hjust = 0.5))+geom_hline(yintercept=0,alpha=.5,lty=2)




#figure E-2: plot of coefficients for left economic attitudes main effect

econmaineffects4 <- 
  structure(list(
    estimate  = c(aus4econb, can4econb, fin4econb, fra4econb, ger4econb, gb4econb, ita4econb, nth4econb, nz4econb, nor4econb, spn4econb, swe4econb, swi4econb, us4econb), 
    lower = c(aus4econlower, can4econlower, fin4econlower, fra4econlower, ger4econlower, gb4econlower, ita4econlower, nth4econlower, nz4econlower, nor4econlower, spn4econlower, swe4econlower, swi4econlower, us4econlower),
    upper = c(aus4econupper, can4econupper, fin4econupper, fra4econupper, ger4econupper, gb4econupper, ita4econupper, nth4econupper, nz4econupper, nor4econupper, spn4econupper, swe4econupper, swi4econupper, us4econupper)),
    .Names = c("estimate", "lower", "upper"), 
    row.names = c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States"), 
    class = "data.frame")



econmaineffects4$source <-  rownames(econmaineffects4)
econmaineffects4$source <-  factor(econmaineffects4$source,levels=rev(econmaineffects4$source))

ggplot(econmaineffects4,aes(x=source,y=estimate))+geom_pointrange(aes(ymin=lower,ymax=upper),shape=15)+ggtitle("Figure E-2: Effect of Left Economic Attitudes on 4-Item Openness to Authoritarian Governance",)+coord_flip()+ylim(c(-.1,.2))+theme_bw()+theme(plot.title = element_text(size = 10))+xlab("")+ylab("")+theme(plot.title = element_text(hjust = 0.5))+geom_hline(yintercept=0,alpha=.5,lty=2)



mean(econmaineffects$estimate)
range(econmaineffects$estimate)

#figure E-3: plot of coefficients for cultural x economic interaction effect

cultxeconints4 <- 
  structure(list(
    estimate  = c(aus4intb, can4intb, fin4intb, fra4intb, ger4intb, gb4intb, ita4intb, nth4intb, nz4intb, nor4intb, spn4intb, swe4intb, swi4intb, us4intb), 
    lower = c(aus4intlower, can4intlower, fin4intlower, fra4intlower, ger4intlower, gb4intlower, ita4intlower, nth4intlower, nz4intlower, nor4intlower, spn4intlower, swe4intlower, swi4intlower, us4intlower),
    upper = c(aus4intupper, can4intupper, fin4intupper, fra4intupper, ger4intupper, gb4intupper, ita4intupper, nth4intupper, nz4intupper, nor4intupper, spn4intupper, swe4intupper, swi4intupper, us4intupper)),
    .Names = c("estimate", "lower", "upper"), 
    row.names = c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States"), 
    class = "data.frame")

cultxeconints4$source <-  rownames(cultxeconints4)
cultxeconints4$source <-  factor(cultxeconints4$source,levels=rev(cultxeconints4$source))

ggplot(cultxeconints4,aes(x=source,y=estimate))+geom_pointrange(aes(ymin=lower,ymax=upper),shape=15)+ggtitle("Figure E-3: Effect of Cultural Conservatism X Left Economic Attitude Interaction on 4-Item \n Openness to Authoritarian Governance",)+coord_flip()+ylim(c(-.1,.15))+theme_bw()+theme(plot.title = element_text(size = 10))+xlab("")+ylab("")+theme(plot.title = element_text(hjust = 0.5))+geom_hline(yintercept=0,alpha=.5,lty=2)



mean(cultxeconints$estimate)
range(cultxeconints$estimate)

#figure E-4: plotting predicted values of openness to auth governance.

authright4 <- 
  structure(list(
    estimate  = c(aus4rightest, can4rightest, fin4rightest, fra4rightest, ger4rightest, gb4rightest, ita4rightest, nth4rightest, nz4rightest, nor4rightest, spn4rightest, swe4rightest, swi4rightest, us4rightest), 
    lower = c(aus4rightlower, can4rightlower, fin4rightlower, fra4rightlower, ger4rightlower, gb4rightlower, ita4rightlower, nth4rightlower, nz4rightlower, nor4rightlower, spn4rightlower, swe4rightlower, swi4rightlower, us4rightlower),
    upper = c(aus4rightupper, can4rightupper, fin4rightupper, fra4rightupper, ger4rightupper, gb4rightupper, ita4rightupper, nth4rightupper, nz4rightupper, nor4rightupper, spn4rightupper, swe4rightupper, swi4rightupper, us4rightupper)),
    .Names = c("estimate", "lower", "upper"), 
    row.names = c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States"), 
    class = "data.frame")


authleft4 <- 
  structure(list(
    estimate  = c(aus4leftest, can4leftest, fin4leftest, fra4leftest, ger4leftest, gb4leftest, ita4leftest, nth4leftest, nz4leftest, nor4leftest, spn4leftest, swe4leftest, swi4leftest, us4leftest), 
    lower = c(aus4leftlower, can4leftlower, fin4leftlower, fra4leftlower, ger4leftlower, gb4leftlower, ita4leftlower, nth4leftlower, nz4leftlower, nor4leftlower, spn4leftlower, swe4leftlower, swi4leftlower, us4leftlower),
    upper = c(aus4leftupper, can4leftupper, fin4leftupper, fra4leftupper, ger4leftupper, gb4leftupper, ita4leftupper, nth4leftupper, nz4leftupper, nor4leftupper, spn4leftupper, swe4leftupper, swi4leftupper, us4leftupper)),
    .Names = c("estimate", "lower", "upper"), 
    row.names = c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States"), 
    class = "data.frame")


authprot4 <- 
  structure(list(
    estimate  = c(aus4protest, can4protest, fin4protest, fra4protest, ger4protest, gb4protest, ita4protest, nth4protest, nz4protest, nor4protest, spn4protest, swe4protest, swi4protest, us4protest), 
    lower = c(aus4protlower, can4protlower, fin4protlower, fra4protlower, ger4protlower, gb4protlower, ita4protlower, nth4protlower, nz4protlower, nor4protlower, spn4protlower, swe4protlower, swi4protlower, us4protlower),
    upper = c(aus4protupper, can4protupper, fin4protupper, fra4protupper, ger4protupper, gb4protupper, ita4protupper, nth4protupper, nz4protupper, nor4protupper, spn4protupper, swe4protupper, swi4protupper, us4protupper)),
    .Names = c("estimate", "lower", "upper"), 
    row.names = c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States"), 
    class = "data.frame")



authfree4 <- 
  structure(list(
    estimate  = c(aus4freeest, can4freeest, fin4freeest, fra4freeest, ger4freeest, gb4freeest, ita4freeest, nth4freeest, nz4freeest, nor4freeest, spn4freeest, swe4freeest, swi4freeest, us4freeest), 
    lower = c(aus4freelower, can4freelower, fin4freelower, fra4freelower, ger4freelower, gb4freelower, ita4freelower, nth4freelower, nz4freelower, nor4freelower, spn4freelower, swe4freelower, swi4freelower, us4freelower),
    upper = c(aus4freeupper, can4freeupper, fin4freeupper, fra4freeupper, ger4freeupper, gb4freeupper, ita4freeupper, nth4freeupper, nz4freeupper, nor4freeupper, spn4freeupper, swe4freeupper, swi4freeupper, us4freeupper)),
    .Names = c("estimate", "lower", "upper"), 
    row.names = c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States"), 
    class = "data.frame")



authfree4$source <- rownames(authfree4)
authfree4$type="Freedom"
authleft4$source <- rownames(authleft4)
authleft4$type="Left"
authright4$source <- rownames(authright4)
authright4$type="Right"
authprot4$source <- rownames(authprot4)
authprot4$type = "Protection"
forplot4 <- rbind(authfree4,authleft4,authright4,authprot4)
forplot4$type <- factor(forplot4$type,levels=c("Right","Left","Protection","Freedom"))
forplot4$source <-  factor(forplot4$source,levels=rev(cultxeconints4$source))

ggplot(forplot4,aes(y=source,x=estimate,shape=type))+geom_point(size=2)+geom_errorbarh(aes(xmin=lower,xmax=upper),height=0)+ggtitle("Figure E-4: Predicted Values of 4-Item Openness to Authoritarian Governance",)+xlim(c(0,.45))+theme_bw()+theme(plot.title = element_text(size = 10))+xlab("")+ylab("")+theme(plot.title = element_text(hjust = 0.5),legend.title = element_blank())+geom_hline(yintercept=0,alpha=.5,lty=2)+theme(legend.position="top")+guides(shape = guide_legend(override.aes = list(size=3))) 


##################

#Figures E5-E8, using non-imputed data

#figure E-5: plot of coefficients for cultural conservatism main effect


cultmaineffectsl <- 
  structure(list(
    estimate  = c(auslcultb, canlcultb, finlcultb, fralcultb, gerlcultb, gblcultb, italcultb, nthlcultb, nzlcultb, norlcultb, spnlcultb, swelcultb, swilcultb, uslcultb, abuslcultest, abcanlcultest, abus19lcultest), 
    lower = c(auslcultlower, canlcultlower, finlcultlower, fralcultlower, gerlcultlower, gblcultlower, italcultlower, nthlcultlower, nzlcultlower, norlcultlower, spnlcultlower, swelcultlower, swilcultlower, uslcultlower, abuslcultlower, abcanlcultlower, abus19lcultlower),
    upper = c(auslcultupper, canlcultupper, finlcultupper, fralcultupper, gerlcultupper, gblcultupper, italcultupper, nthlcultupper, nzlcultupper, norlcultupper, spnlcultupper, swelcultupper, swilcultupper, uslcultupper, abuslcultupper, abcanlcultupper, abus19lcultupper)),
    .Names = c("estimate", "lower", "upper"), 
    row.names = c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States", "LAPOP U.S.-2017", "LAPOP Canada-2017", "LAPOP U.S.-2019"), 
    class = "data.frame")

mean(cultmaineffectsl$estimate)
range(cultmaineffectsl$estimate)


library(ggplot2)

cultmaineffectsl$source <-  rownames(cultmaineffectsl)
cultmaineffectsl$source <-  factor(cultmaineffectsl$source,levels=rev(cultmaineffectsl$source))

ggplot(cultmaineffectsl,aes(x=source,y=estimate))+geom_pointrange(aes(ymin=lower,ymax=upper),shape=15)+ggtitle("Figure E-5: Effect of Cultural Conservatism on Openness to Authoritarian Governance \n (Without Imputation)",)+coord_flip()+ylim(c(0,.2))+theme_bw()+theme(plot.title = element_text(size = 10))+xlab("")+ylab("")+theme(plot.title = element_text(hjust = 0.5))+geom_hline(yintercept=0,alpha=.5,lty=2)




#figure E-6: plot of coefficients for left economic attitudes main effect

econmaineffectsl <- 
  structure(list(
    estimate  = c(ausleconb, canleconb, finleconb, fraleconb, gerleconb, gbleconb, italeconb, nthleconb, nzleconb, norleconb, spnleconb, sweleconb, swileconb, usleconb, abusleconest, abcanleconest, abus19leconest), 
    lower = c(ausleconlower, canleconlower, finleconlower, fraleconlower, gerleconlower, gbleconlower, italeconlower, nthleconlower, nzleconlower, norleconlower, spnleconlower, sweleconlower, swileconlower, usleconlower, abusleconlower, abcanleconlower, abus19leconlower),
    upper = c(ausleconupper, canleconupper, finleconupper, fraleconupper, gerleconupper, gbleconupper, italeconupper, nthleconupper, nzleconupper, norleconupper, spnleconupper, sweleconupper, swileconupper, usleconupper, abusleconupper, abcanleconupper, abus19leconupper)),
    .Names = c("estimate", "lower", "upper"), 
    row.names = c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States", "LAPOP U.S.-2017", "LAPOP Canada-2017", "LAPOP U.S.-2019"), 
    class = "data.frame")



econmaineffectsl$source <-  rownames(econmaineffectsl)
econmaineffectsl$source <-  factor(econmaineffectsl$source,levels=rev(econmaineffectsl$source))

ggplot(econmaineffectsl,aes(x=source,y=estimate))+geom_pointrange(aes(ymin=lower,ymax=upper),shape=15)+ggtitle("Figure E-6: Effect of Left Economic Attitudes on Openness to Authoritarian Governance\n (Without Imputation)",)+coord_flip()+ylim(c(-.1,.15))+theme_bw()+theme(plot.title = element_text(size = 10))+xlab("")+ylab("")+theme(plot.title = element_text(hjust = 0.5))+geom_hline(yintercept=0,alpha=.5,lty=2)



mean(econmaineffects$estimate)
range(econmaineffects$estimate)

#figure E-7: plot of coefficients for cultural x economic interaction effect

cultxeconintsl <- 
  structure(list(
    estimate  = c(auslintb, canlintb, finlintb, fralintb, gerlintb, gblintb, italintb, nthlintb, nzlintb, norlintb, spnlintb, swelintb, swilintb, uslintb, abuslintest, abcanlintest, abus19lintest), 
    lower = c(auslintlower, canlintlower, finlintlower, fralintlower, gerlintlower, gblintlower, italintlower, nthlintlower, nzlintlower, norlintlower, spnlintlower, swelintlower, swilintlower, uslintlower, abuslintlower, abcanlintlower, abus19lintlower),
    upper = c(auslintupper, canlintupper, finlintupper, fralintupper, gerlintupper, gblintupper, italintupper, nthlintupper, nzlintupper, norlintupper, spnlintupper, swelintupper, swilintupper, uslintupper, abuslintupper, abcanlintupper, abus19lintupper)),
    .Names = c("estimate", "lower", "upper"), 
    row.names = c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States", "LAPOP U.S.-2017", "LAPOP Canada-2017", "LAPOP U.S.-2019"), 
    class = "data.frame")

cultxeconintsl$source <-  rownames(cultxeconintsl)
cultxeconintsl$source <-  factor(cultxeconintsl$source,levels=rev(cultxeconintsl$source))

ggplot(cultxeconintsl,aes(x=source,y=estimate))+geom_pointrange(aes(ymin=lower,ymax=upper),shape=15)+ggtitle("Figure E-7: Effect of Cultural Conservatism X Left Economic Attitude Interaction on \n Openness to Authoritarian Governance (Without Imputation)",)+coord_flip()+ylim(c(-.1,.25))+theme_bw()+theme(plot.title = element_text(size = 10))+xlab("")+ylab("")+theme(plot.title = element_text(hjust = 0.5))+geom_hline(yintercept=0,alpha=.5,lty=2)



mean(cultxeconints$estimate)
range(cultxeconints$estimate)

#figure E-8: plotting predicted values of openness to auth governance.

authrightl <- 
  structure(list(
    estimate  = c(auslrightest, canlrightest, finlrightest, fralrightest, gerlrightest, gblrightest, italrightest, nthlrightest, nzlrightest, norlrightest, spnlrightest, swelrightest, swilrightest, uslrightest, abuslrightest, abcanlrightest, abus19lrightest), 
    lower = c(auslrightlower, canlrightlower, finlrightlower, fralrightlower, gerlrightlower, gblrightlower, italrightlower, nthlrightlower, nzlrightlower, norlrightlower, spnlrightlower, swelrightlower, swilrightlower, uslrightlower, abuslrightlower, abcanlrightlower, abus19lrightlower),
    upper = c(auslrightupper, canlrightupper, finlrightupper, fralrightupper, gerlrightupper, gblrightupper, italrightupper, nthlrightupper, nzlrightupper, norlrightupper, spnlrightupper, swelrightupper, swilrightupper, uslrightupper, abuslrightupper, abcanlrightupper, abus19lrightupper)),
    .Names = c("estimate", "lower", "upper"), 
    row.names = c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States", "LAPOP U.S.-2017", "LAPOP Canada-2017", "LAPOP U.S.-2019"), 
    class = "data.frame")


authleftl <- 
  structure(list(
    estimate  = c(auslleftest, canlleftest, finlleftest, fralleftest, gerlleftest, gblleftest, italleftest, nthlleftest, nzlleftest, norlleftest, spnlleftest, swelleftest, swilleftest, uslleftest, abuslleftest, abcanlleftest, abus19lleftest), 
    lower = c(auslleftlower, canlleftlower, finlleftlower, fralleftlower, gerlleftlower, gblleftlower, italleftlower, nthlleftlower, nzlleftlower, norlleftlower, spnlleftlower, swelleftlower, swilleftlower, uslleftlower, abuslleftlower, abcanlleftlower, abus19lleftlower),
    upper = c(auslleftupper, canlleftupper, finlleftupper, fralleftupper, gerlleftupper, gblleftupper, italleftupper, nthlleftupper, nzlleftupper, norlleftupper, spnlleftupper, swelleftupper, swilleftupper, uslleftupper, abuslleftupper, abcanlleftupper, abus19lleftupper)),
    .Names = c("estimate", "lower", "upper"), 
    row.names = c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States", "LAPOP U.S.-2017", "LAPOP Canada-2017", "LAPOP U.S.-2019"), 
    class = "data.frame")


authprotl <- 
  structure(list(
    estimate  = c(auslprotest, canlprotest, finlprotest, fralprotest, gerlprotest, gblprotest, italprotest, nthlprotest, nzlprotest, norlprotest, spnlprotest, swelprotest, swilprotest, uslprotest, abuslprotest, abcanlprotest, abus19lprotest), 
    lower = c(auslprotlower, canlprotlower, finlprotlower, fralprotlower, gerlprotlower, gblprotlower, italprotlower, nthlprotlower, nzlprotlower, norlprotlower, spnlprotlower, swelprotlower, swilprotlower, uslprotlower, abuslprotlower, abcanlprotlower, abus19lprotlower),
    upper = c(auslprotupper, canlprotupper, finlprotupper, fralprotupper, gerlprotupper, gblprotupper, italprotupper, nthlprotupper, nzlprotupper, norlprotupper, spnlprotupper, swelprotupper, swilprotupper, uslprotupper, abuslprotupper, abcanlprotupper, abus19lprotupper)),
    .Names = c("estimate", "lower", "upper"), 
    row.names = c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States", "LAPOP U.S.-2017", "LAPOP Canada-2017", "LAPOP U.S.-2019"), 
    class = "data.frame")



authfreel <- 
  structure(list(
    estimate  = c(auslfreeest, canlfreeest, finlfreeest, fralfreeest, gerlfreeest, gblfreeest, italfreeest, nthlfreeest, nzlfreeest, norlfreeest, spnlfreeest, swelfreeest, swilfreeest, uslfreeest, abuslfreeest, abcanlfreeest, abus19lfreeest), 
    lower = c(auslfreelower, canlfreelower, finlfreelower, fralfreelower, gerlfreelower, gblfreelower, italfreelower, nthlfreelower, nzlfreelower, norlfreelower, spnlfreelower, swelfreelower, swilfreelower, uslfreelower, abuslfreelower, abcanlfreelower, abus19lfreelower),
    upper = c(auslfreeupper, canlfreeupper, finlfreeupper, fralfreeupper, gerlfreeupper, gblfreeupper, italfreeupper, nthlfreeupper, nzlfreeupper, norlfreeupper, spnlfreeupper, swelfreeupper, swilfreeupper, uslfreeupper, abuslfreeupper, abcanlfreeupper, abus19lfreeupper)),
    .Names = c("estimate", "lower", "upper"), 
    row.names = c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States", "LAPOP U.S.-2017", "LAPOP Canada-2017", "LAPOP U.S.-2019"), 
    class = "data.frame")



authfreel$source <- rownames(authfreel)
authfreel$type="Freedom"
authleftl$source <- rownames(authleftl)
authleftl$type="Left"
authrightl$source <- rownames(authrightl)
authrightl$type="Right"
authprotl$source <- rownames(authprotl)

authprotl$type = "Protection"
forplotl <- rbind(authfreel,authleftl,authrightl,authprotl)
forplotl$type <- factor(forplotl$type,levels=c("Right","Left","Protection","Freedom"))
forplotl$source <-  factor(forplotl$source,levels=rev(cultxeconintsl$source))

ggplot(forplotl,aes(y=source,x=estimate,shape=type))+geom_point(size=2)+geom_errorbarh(aes(xmin=lower,xmax=upper),height=0)+ggtitle("Figure E-8: Predicted Values of Openness to Authoritarian Governance \n (Without Imputation)",)+xlim(c(0,.45))+theme_bw()+theme(plot.title = element_text(size = 10))+xlab("")+ylab("")+theme(plot.title = element_text(hjust = 0.5),legend.title = element_blank())+geom_hline(yintercept=0,alpha=.5,lty=2)+theme(legend.position="top")+guides(shape = guide_legend(override.aes = list(size=3))) 


#SOM Table C-1: correlations between openness to authoritarian governance and external criteria


#education
authgov<-list()
authgov[[1]]<-cor.test(west$authgov3i[west$country=="Australia"], west$collegedegree[west$country=="Australia"], use="PAIR")
authgov[[2]]<-cor.test(west$authgov3i[west$country=="Canada"], west$collegedegree[west$country=="Canada"])
authgov[[3]]<-cor.test(west$authgov3i[west$country=="Finland"], west$collegedegree[west$country=="Finland"])
authgov[[4]]<-cor.test(west$authgov3i[west$country=="France"], west$collegedegree[west$country=="France"])
authgov[[5]]<-cor.test(west$authgov3i[west$country=="Germany"], west$collegedegree[west$country=="Germany"])
authgov[[6]]<-cor.test(west$authgov3i[west$country=="Great Britain"], west$collegedegree[west$country=="Great Britain"])
authgov[[7]]<-cor.test(west$authgov3i[west$country=="Italy"], west$collegedegree[west$country=="Italy"])
authgov[[8]]<-cor.test(west$authgov3i[west$country=="Netherlands"], west$collegedegree[west$country=="Netherlands"])
authgov[[9]]<-cor.test(west$authgov3i[west$country=="New Zealand"], west$collegedegree[west$country=="New Zealand"])
authgov[[10]]<-cor.test(west$authgov3i[west$country=="Norway"], west$collegedegree[west$country=="Norway"])
authgov[[11]]<-cor.test(west$authgov3i[west$country=="Spain"], west$collegedegree[west$country=="Spain"])
authgov[[12]]<-cor.test(west$authgov3i[west$country=="Sweden"], west$collegedegree[west$country=="Sweden"])
authgov[[13]]<-cor.test(west$authgov3i[west$country=="Switzerland"], west$collegedegree[west$country=="Switzerland"])
authgov[[14]]<-cor.test(west$authgov3i[west$country=="United States"], west$collegedegree[west$country=="United States"])
authgov[[15]]<-cor.test(abus$authgov, abus$collegedegree)
authgov[[16]]<-cor.test(abcan$authgov, abcan$collegedegree)
authgov[[17]]<-cor.test(abus19$authgov, abus19$collegedegree)

authgov_estimate<-rbind(authgov[[1]]$estimate, authgov[[2]]$estimate, authgov[[3]]$estimate, authgov[[4]]$estimate, authgov[[5]]$estimate, authgov[[6]]$estimate, authgov[[7]]$estimate, authgov[[8]]$estimate, authgov[[9]]$estimate, authgov[[10]]$estimate, authgov[[11]]$estimate, authgov[[12]]$estimate, authgov[[13]]$estimate, authgov[[14]]$estimate, authgov[[15]]$estimate, authgov[[16]]$estimate, authgov[[17]]$estimate)

authgov_p<-rbind(authgov[[1]]$p.value, authgov[[2]]$p.value, authgov[[3]]$p.value, authgov[[4]]$p.value, authgov[[5]]$p.value, authgov[[6]]$p.value, authgov[[7]]$p.value, authgov[[8]]$p.value, authgov[[9]]$p.value, authgov[[10]]$p.value, authgov[[11]]$p.value, authgov[[12]]$p.value, authgov[[13]]$p.value, authgov[[14]]$p.value, authgov[[15]]$p.value, authgov[[16]]$p.value, authgov[[17]]$p.value)

auth_education<-cbind(authgov_estimate, authgov_p)

#political engagement
auth_eng<-list()
auth_eng[[1]]<-cor.test(west$authgov3i[west$country=="Australia"], west$poleng[west$country=="Australia"])
auth_eng[[2]]<-cor.test(west$authgov3i[west$country=="Canada"], west$poleng[west$country=="Canada"])
auth_eng[[3]]<-cor.test(west$authgov3i[west$country=="Finland"], west$poleng[west$country=="Finland"])
auth_eng[[4]]<-cor.test(west$authgov3i[west$country=="France"], west$poleng[west$country=="France"])
auth_eng[[5]]<-cor.test(west$authgov3i[west$country=="Germany"], west$poleng[west$country=="Germany"])
auth_eng[[6]]<-cor.test(west$authgov3i[west$country=="Great Britain"], west$poleng[west$country=="Great Britain"])
auth_eng[[7]]<-cor.test(west$authgov3i[west$country=="Italy"], west$poleng[west$country=="Italy"])
auth_eng[[8]]<-cor.test(west$authgov3i[west$country=="Netherlands"], west$poleng[west$country=="Netherlands"])
auth_eng[[9]]<-cor.test(west$authgov3i[west$country=="New Zealand"], west$poleng[west$country=="New Zealand"])
auth_eng[[10]]<-cor.test(west$authgov3i[west$country=="Norway"], west$poleng[west$country=="Norway"])
auth_eng[[11]]<-cor.test(west$authgov3i[west$country=="Spain"], west$poleng[west$country=="Spain"])
auth_eng[[12]]<-cor.test(west$authgov3i[west$country=="Sweden"], west$poleng[west$country=="Sweden"])
auth_eng[[13]]<-cor.test(west$authgov3i[west$country=="Switzerland"], west$poleng[west$country=="Switzerland"])
auth_eng[[14]]<-cor.test(west$authgov3i[west$country=="United States"], west$poleng[west$country=="United States"])
auth_eng[[15]]<-cor.test(abus$authgov, abus$polint)
auth_eng[[16]]<-cor.test(abcan$authgov, abcan$polint)
auth_eng[[17]]<-cor.test(abus19$authgov, abus19$polint)

auth_eng_estimate <-rbind(auth_eng[[1]]$estimate, auth_eng[[2]]$estimate, auth_eng[[3]]$estimate, auth_eng[[4]]$estimate, auth_eng[[5]]$estimate, auth_eng[[6]]$estimate, auth_eng[[7]]$estimate, auth_eng[[8]]$estimate, auth_eng[[9]]$estimate, auth_eng[[10]]$estimate, auth_eng[[11]]$estimate, auth_eng[[12]]$estimate, auth_eng[[13]]$estimate, auth_eng[[14]]$estimate, auth_eng[[15]]$estimate, auth_eng[[16]]$estimate, auth_eng[[17]]$estimate)

auth_eng_pvalues <-rbind(auth_eng[[1]]$p.value, auth_eng[[2]]$p.value, auth_eng[[3]]$p.value, auth_eng[[4]]$p.value, auth_eng[[5]]$p.value, auth_eng[[6]]$p.value, auth_eng[[7]]$p.value, auth_eng[[8]]$p.value, auth_eng[[9]]$p.value, auth_eng[[10]]$p.value, auth_eng[[11]]$p.value, auth_eng[[12]]$p.value, auth_eng[[13]]$p.value, auth_eng[[14]]$p.value, auth_eng[[15]]$p.value, auth_eng[[16]]$p.value, auth_eng[[17]]$p.value)

auth_eng<-cbind(auth_eng_estimate, auth_eng_pvalues)

for_tableC_auth<-cbind(auth_education, auth_eng)


colnames(for_tableC_auth)<-c("Education", "p-value: Education",  "Political engagement", "p-value: political engagement")
rownames(for_tableC_auth)<-c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States", "LAPOP U.S.-2017", "LAPOP Canada-2017", "LAPOP U.S.-2019")

library("stargazer")

stargazer(for_tableC_auth,type="html", digits=3,  title="Table C-1:  Correlations of Openness to Authoritarian Governance with External Criteria", font.size = "tiny", out="authgovcorrstable.doc")

#Table C-2: SOM cultural conservatism correlations with external criteria

#with econ
cult_econ<-list()
cult_econ[[1]]<-cor.test(west$cultright[west$country=="Australia"], west$econleft[west$country=="Australia"])
cult_econ[[2]]<-cor.test(west$cultright[west$country=="Canada"], west$econleft[west$country=="Canada"])
cult_econ[[3]]<-cor.test(west$cultright[west$country=="Finland"], west$econleft[west$country=="Finland"])
cult_econ[[4]]<-cor.test(west$cultright[west$country=="France"], west$econleft[west$country=="France"])
cult_econ[[5]]<-cor.test(west$cultright[west$country=="Germany"], west$econleft[west$country=="Germany"])
cult_econ[[6]]<-cor.test(west$cultright[west$country=="Great Britain"], west$econleft[west$country=="Great Britain"])
cult_econ[[7]]<-cor.test(west$cultright[west$country=="Italy"], west$econleft[west$country=="Italy"])
cult_econ[[8]]<-cor.test(west$cultright[west$country=="Netherlands"], west$econleft[west$country=="Netherlands"])
cult_econ[[9]]<-cor.test(west$cultright[west$country=="New Zealand"], west$econleft[west$country=="New Zealand"])
cult_econ[[10]]<-cor.test(west$cultright[west$country=="Norway"], west$econleft[west$country=="Norway"])
cult_econ[[11]]<-cor.test(west$cultright[west$country=="Spain"], west$econleft[west$country=="Spain"])
cult_econ[[12]]<-cor.test(west$cultright[west$country=="Sweden"], west$econleft[west$country=="Sweden"])
cult_econ[[13]]<-cor.test(west$cultright[west$country=="Switzerland"], west$econleft[west$country=="Switzerland"])
cult_econ[[14]]<-cor.test(west$cultright[west$country=="United States"], west$econleft[west$country=="United States"])
cult_econ[[15]]<-cor.test(abus$cultright, abus$econleft)
cult_econ[[16]]<-cor.test(abcan$cultright, abcan$econleft)
cult_econ[[17]]<-cor.test(abus19$cultright, abus19$econleft)

cult_econ_corr<-rbind(cult_econ[[1]]$estimate, cult_econ[[2]]$estimate, cult_econ[[3]]$estimate, cult_econ[[4]]$estimate, cult_econ[[5]]$estimate, cult_econ[[6]]$estimate, cult_econ[[7]]$estimate, cult_econ[[8]]$estimate, cult_econ[[9]]$estimate, cult_econ[[10]]$estimate, cult_econ[[11]]$estimate, cult_econ[[12]]$estimate, cult_econ[[13]]$estimate, cult_econ[[14]]$estimate, cult_econ[[15]]$estimate, cult_econ[[16]]$estimate, cult_econ[[17]]$estimate)

cult_econ_p<-rbind(cult_econ[[1]]$p.value, cult_econ[[2]]$p.value, cult_econ[[3]]$p.value, cult_econ[[4]]$p.value, cult_econ[[5]]$p.value, cult_econ[[6]]$p.value, cult_econ[[7]]$p.value, cult_econ[[8]]$p.value, cult_econ[[9]]$p.value, cult_econ[[10]]$p.value, cult_econ[[11]]$p.value, cult_econ[[12]]$p.value, cult_econ[[13]]$p.value, cult_econ[[14]]$p.value, cult_econ[[15]]$p.value, cult_econ[[16]]$p.value, cult_econ[[17]]$p.value)

cult_econ <- cbind(cult_econ_corr, cult_econ_p)

# with age
cult_age<-list()
cult_age[[1]]<-cor.test(west$cultright[west$country=="Australia"], west$ageyears[west$country=="Australia"])
cult_age[[2]]<-cor.test(west$cultright[west$country=="Canada"], west$ageyears[west$country=="Canada"])
cult_age[[3]]<-cor.test(west$cultright[west$country=="Finland"], west$ageyears[west$country=="Finland"])
cult_age[[4]]<-cor.test(west$cultright[west$country=="France"], west$ageyears[west$country=="France"])
cult_age[[5]]<-cor.test(west$cultright[west$country=="Germany"], west$ageyears[west$country=="Germany"])
cult_age[[6]]<-cor.test(west$cultright[west$country=="Great Britain"], west$ageyears[west$country=="Great Britain"])
cult_age[[7]]<-cor.test(west$cultright[west$country=="Italy"], west$ageyears[west$country=="Italy"])
cult_age[[8]]<-cor.test(west$cultright[west$country=="Netherlands"], west$ageyears[west$country=="Netherlands"])
cult_age[[9]]<-cor.test(west$cultright[west$country=="New Zealand"], west$ageyears[west$country=="New Zealand"])
cult_age[[10]]<-cor.test(west$cultright[west$country=="Norway"], west$ageyears[west$country=="Norway"])
cult_age[[11]]<-cor.test(west$cultright[west$country=="Spain"], west$ageyears[west$country=="Spain"])
cult_age[[12]]<-cor.test(west$cultright[west$country=="Sweden"], west$ageyears[west$country=="Sweden"])
cult_age[[13]]<-cor.test(west$cultright[west$country=="Switzerland"], west$ageyears[west$country=="Switzerland"])
cult_age[[14]]<-cor.test(west$cultright[west$country=="United States"], west$ageyears[west$country=="United States"])
cult_age[[15]]<-cor.test(abus$cultright, abus$ageyears)
cult_age[[16]]<-cor.test(abcan$cultright, abcan$ageyears)
cult_age[[17]]<-cor.test(abus19$cultright, abus19$ageyears)

cultwithage_est<-rbind(cult_age[[1]]$estimate, cult_age[[2]]$estimate, cult_age[[3]]$estimate, cult_age[[4]]$estimate, cult_age[[5]]$estimate, cult_age[[6]]$estimate, cult_age[[7]]$estimate, cult_age[[8]]$estimate, cult_age[[9]]$estimate, cult_age[[10]]$estimate, cult_age[[11]]$estimate, cult_age[[12]]$estimate, cult_age[[13]]$estimate, cult_age[[14]]$estimate, cult_age[[15]]$estimate, cult_age[[16]]$estimate, cult_age[[17]]$estimate)

cultwithage_p<-rbind(cult_age[[1]]$p.value, cult_age[[2]]$p.value, cult_age[[3]]$p.value, cult_age[[4]]$p.value, cult_age[[5]]$p.value, cult_age[[6]]$p.value, cult_age[[7]]$p.value, cult_age[[8]]$p.value, cult_age[[9]]$p.value, cult_age[[10]]$p.value, cult_age[[11]]$p.value, cult_age[[12]]$p.value, cult_age[[13]]$p.value, cult_age[[14]]$p.value, cult_age[[15]]$p.value, cult_age[[16]]$p.value, cult_age[[17]]$p.value)

cultwithage <- cbind(cultwithage_est, cultwithage_p)

#with education
cult_college<-list()
cult_college[[1]]<-cor.test(west$cultright[west$country=="Australia"], west$collegedegree[west$country=="Australia"])
cult_college[[2]]<-cor.test(west$cultright[west$country=="Canada"], west$collegedegree[west$country=="Canada"])
cult_college[[3]]<-cor.test(west$cultright[west$country=="Finland"], west$collegedegree[west$country=="Finland"])
cult_college[[4]]<-cor.test(west$cultright[west$country=="France"], west$collegedegree[west$country=="France"])
cult_college[[5]]<-cor.test(west$cultright[west$country=="Germany"], west$collegedegree[west$country=="Germany"])
cult_college[[6]]<-cor.test(west$cultright[west$country=="Great Britain"], west$collegedegree[west$country=="Great Britain"])
cult_college[[7]]<-cor.test(west$cultright[west$country=="Italy"], west$collegedegree[west$country=="Italy"])
cult_college[[8]]<-cor.test(west$cultright[west$country=="Netherlands"], west$collegedegree[west$country=="Netherlands"])
cult_college[[9]]<-cor.test(west$cultright[west$country=="New Zealand"], west$collegedegree[west$country=="New Zealand"])
cult_college[[10]]<-cor.test(west$cultright[west$country=="Norway"], west$collegedegree[west$country=="Norway"])
cult_college[[11]]<-cor.test(west$cultright[west$country=="Spain"], west$collegedegree[west$country=="Spain"])
cult_college[[12]]<-cor.test(west$cultright[west$country=="Sweden"], west$collegedegree[west$country=="Sweden"])
cult_college[[13]]<-cor.test(west$cultright[west$country=="Switzerland"], west$collegedegree[west$country=="Switzerland"])
cult_college[[14]]<-cor.test(west$cultright[west$country=="United States"], west$collegedegree[west$country=="United States"])
cult_college[[15]]<-cor.test(abus$cultright, abus$collegedegree)
cult_college[[16]]<-cor.test(abcan$cultright, abcan$collegedegree)
cult_college[[17]]<-cor.test(abus19$cultright, abus19$collegedegree)

cult_college_cor<-rbind(cult_college[[1]]$estimate, cult_college[[2]]$estimate, cult_college[[3]]$estimate, cult_college[[4]]$estimate, cult_college[[5]]$estimate, cult_college[[6]]$estimate, cult_college[[7]]$estimate, cult_college[[8]]$estimate, cult_college[[9]]$estimate, cult_college[[10]]$estimate, cult_college[[11]]$estimate, cult_college[[12]]$estimate, cult_college[[13]]$estimate, cult_college[[14]]$estimate, cult_college[[15]]$estimate, cult_college[[16]]$estimate, cult_college[[17]]$estimate)

cult_college_p<-rbind(cult_college[[1]]$p.value, cult_college[[2]]$p.value, cult_college[[3]]$p.value, cult_college[[4]]$p.value, cult_college[[5]]$p.value, cult_college[[6]]$p.value, cult_college[[7]]$p.value, cult_college[[8]]$p.value, cult_college[[9]]$p.value, cult_college[[10]]$p.value, cult_college[[11]]$p.value, cult_college[[12]]$p.value, cult_college[[13]]$p.value, cult_college[[14]]$p.value, cult_college[[15]]$p.value, cult_college[[16]]$p.value, cult_college[[17]]$p.value)

cult_college <- cbind(cult_college_cor, cult_college_p)


#TableC C2 for cultural conservatism
for_tableC2<-cbind(cult_econ, cultwithage, cult_college)

colnames(for_tableC2)<-c("Left Economic Attitudes", "p-value",  "Age", "p-value", "College Education", "p-value")
rownames(for_tableC2)<-c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States", "LAPOP U.S.-2017", "LAPOP Canada-2017", "LAPOP U.S.-2019")

stargazer(for_tableC2,type="html", digits=3,  title="Table C-2:  Correlations of Cultural Conservatism with External Criteria", font.size = "tiny", out="culturalcorrstable.doc")

abus$cultnorelig<-with(abus, rowMeans(data.frame(againstsamesexmarriage, punishcriminals)),na.rm=T)
abcan$cultnorelig<-with(abcan, rowMeans(data.frame(againstsamesexmarriage, punishcriminals)),na.rm=T)

cor.test(abus$collegedegree, abus$cultnorelig, use="PAIR")
cor.test(abcan$collegedegree, abcan$cultnorelig, use="PAIR")
cor.test(abus19$collegedegree, abus19$menbetterleaders, use="PAIR")


#Table C3 - economic conservatism correlations with external criteria, for SOM


#income
econ_income<-list()
econ_income[[1]]<-cor.test(west$econleft[west$country=="Australia"], west$hhincdecile[west$country=="Australia"])
econ_income[[2]]<-cor.test(west$econleft[west$country=="Canada"], west$hhincdecile[west$country=="Canada"])
econ_income[[3]]<-cor.test(west$econleft[west$country=="Finland"], west$hhincdecile[west$country=="Finland"])
econ_income[[4]]<-cor.test(west$econleft[west$country=="France"], west$hhincdecile[west$country=="France"])
econ_income[[5]]<-cor.test(west$econleft[west$country=="Germany"], west$hhincdecile[west$country=="Germany"])
econ_income[[6]]<-cor.test(west$econleft[west$country=="Great Britain"], west$hhincdecile[west$country=="Great Britain"])
econ_income[[7]]<-cor.test(west$econleft[west$country=="Italy"], west$hhincdecile[west$country=="Italy"])
econ_income[[8]]<-cor.test(west$econleft[west$country=="Netherlands"], west$hhincdecile[west$country=="Netherlands"])
econ_income[[9]]<-cor.test(west$econleft[west$country=="New Zealand"], west$hhincdecile[west$country=="New Zealand"])
econ_income[[10]]<-cor.test(west$econleft[west$country=="Norway"], west$hhincdecile[west$country=="Norway"])
econ_income[[11]]<-cor.test(west$econleft[west$country=="Spain"], west$hhincdecile[west$country=="Spain"])
econ_income[[12]]<-cor.test(west$econleft[west$country=="Sweden"], west$hhincdecile[west$country=="Sweden"])
econ_income[[13]]<-cor.test(west$econleft[west$country=="Switzerland"], west$hhincdecile[west$country=="Switzerland"])
econ_income[[14]]<-cor.test(west$econleft[west$country=="United States"], west$hhincdecile[west$country=="United States"])
econ_income[[15]]<-cor.test(abus$econleft, abus$hhincome)
econ_income[[16]]<-cor.test(abcan$econleft, abcan$hhincome)
econ_income[[17]]<-cor.test(abus19$econleft, abus19$hhincome)

econ_income_estimate<-rbind(econ_income[[1]]$estimate, econ_income[[2]]$estimate, econ_income[[3]]$estimate, econ_income[[4]]$estimate, econ_income[[5]]$estimate, econ_income[[6]]$estimate, econ_income[[7]]$estimate, econ_income[[8]]$estimate, econ_income[[9]]$estimate, econ_income[[10]]$estimate, econ_income[[11]]$estimate, econ_income[[12]]$estimate, econ_income[[13]]$estimate, econ_income[[14]]$estimate, econ_income[[15]]$estimate, econ_income[[16]]$estimate, econ_income[[17]]$estimate)

econ_income_p<-rbind(econ_income[[1]]$p.value, econ_income[[2]]$p.value, econ_income[[3]]$p.value, econ_income[[4]]$p.value, econ_income[[5]]$p.value, econ_income[[6]]$p.value, econ_income[[7]]$p.value, econ_income[[8]]$p.value, econ_income[[9]]$p.value, econ_income[[10]]$p.value, econ_income[[11]]$p.value, econ_income[[12]]$p.value, econ_income[[13]]$p.value, econ_income[[14]]$p.value, econ_income[[15]]$p.value, econ_income[[16]]$p.value, econ_income[[17]]$p.value)

econ_income<-round(cbind(econ_income_estimate, econ_income_p), digits=3)





#econleft with financial satisfaction
econ_finan<-list()
econ_finan[[1]]<-cor.test(west$econleft[west$country=="Australia"], west$finansat[west$country=="Australia"])
econ_finan[[2]]<-cor.test(west$econleft[west$country=="Canada"], west$finansat[west$country=="Canada"])
econ_finan[[3]]<-cor.test(west$econleft[west$country=="Finland"], west$finansat[west$country=="Finland"])
econ_finan[[4]]<-cor.test(west$econleft[west$country=="France"], west$finansat[west$country=="France"])
econ_finan[[5]]<-cor.test(west$econleft[west$country=="Germany"], west$finansat[west$country=="Germany"])
econ_finan[[6]]<-cor.test(west$econleft[west$country=="Great Britain"], west$finansat[west$country=="Great Britain"])
econ_finan[[7]]<-cor.test(west$econleft[west$country=="Italy"], west$finansat[west$country=="Italy"])
econ_finan[[8]]<-cor.test(west$econleft[west$country=="Netherlands"], west$finansat[west$country=="Netherlands"])
econ_finan[[9]]<-cor.test(west$econleft[west$country=="New Zealand"], west$finansat[west$country=="New Zealand"])
econ_finan[[10]]<-cor.test(west$econleft[west$country=="Norway"], west$finansat[west$country=="Norway"])
econ_finan[[11]]<-cor.test(west$econleft[west$country=="Spain"], west$finansat[west$country=="Spain"])
econ_finan[[12]]<-cor.test(west$econleft[west$country=="Sweden"], west$finansat[west$country=="Sweden"])
econ_finan[[13]]<-cor.test(west$econleft[west$country=="Switzerland"], west$finansat[west$country=="Switzerland"])
econ_finan[[14]]<-cor.test(west$econleft[west$country=="United States"], west$finansat[west$country=="United States"])


econ_finan_estimate<-rbind(econ_finan[[1]]$estimate, econ_finan[[2]]$estimate, econ_finan[[3]]$estimate, econ_finan[[4]]$estimate, econ_finan[[5]]$estimate, econ_finan[[6]]$estimate, econ_finan[[7]]$estimate, econ_finan[[8]]$estimate, econ_finan[[9]]$estimate, econ_finan[[10]]$estimate, econ_finan[[11]]$estimate, econ_finan[[12]]$estimate, econ_finan[[13]]$estimate, econ_finan[[14]]$estimate)

length(econ_finan_estimate)<-17

econ_finan_p<-rbind(econ_finan[[1]]$p.value, econ_finan[[2]]$p.value, econ_finan[[3]]$p.value, econ_finan[[4]]$p.value, econ_finan[[5]]$p.value, econ_finan[[6]]$p.value, econ_finan[[7]]$p.value, econ_finan[[8]]$p.value, econ_finan[[9]]$p.value, econ_finan[[10]]$p.value, econ_finan[[11]]$p.value, econ_finan[[12]]$p.value, econ_finan[[13]]$p.value, econ_finan[[14]]$p.value)

length(econ_finan_p)<-17


econ_finan<-round(cbind(econ_finan_estimate, econ_finan_p), digits=3)


for_tableC3_econ<-cbind(econ_income, econ_finan)


colnames(for_tableC3_econ)<-c("Household Income", "p-value", "Financial Satisfaction", "p-value")
rownames(for_tableC3_econ)<-c("WVS Australia", "WVS Canada", "WVS Finland", "WVS France", "WVS Germany", "WVS Great Britain", "WVS Italy", "WVS Netherlands", "WVS New Zealand", "WVS Norway", "WVS Spain", "WVS Sweden", "WVS Switzerland", "WVS United States", "LAPOP U.S.-2017", "LAPOP Canada-2017", "LAPOP U.S.-2019")

stargazer(for_tableC3_econ, type="html", digits = 3, title="Table C-3:  Correlations of Left Economic Attitudes with External Criteria", font.size = "tiny", out="econleftcorrstable.doc")


#Table B-2 in SOM - Percentage of respondents with data on each WVS item across countries

west2 <- west %>%
  mutate(strongleader = 1-as.numeric(is.na(strongleader)))  %>% 
  mutate(armyrule = 1-as.numeric(is.na(armyrule)))%>% 
  mutate(expertsdecide = 1-as.numeric(is.na(expertsdecide))) %>% 
  mutate(democpolbad = 1-as.numeric(is.na(democpolbad))) %>% 
  mutate(religimp = 1-as.numeric(is.na(religimp))) %>% 
  mutate(relchild = 1-as.numeric(is.na(relchild))) %>% 
  mutate(relatt = 1-as.numeric(is.na(relatt))) %>% 
  mutate(religid = 1-as.numeric(is.na(religid))) %>% 
  mutate(godimp = 1-as.numeric(is.na(godimp))) %>% 
  mutate(indepchildrev = 1-as.numeric(is.na(indepchildrev))) %>% 
  mutate(imagchildrev = 1-as.numeric(is.na(imagchildrev))) %>% 
  mutate(obedchild = 1-as.numeric(is.na(obedchild))) %>% 
  mutate(nototherrace = 1-as.numeric(is.na(nototherrace))) %>% 
  mutate(notimmig = 1-as.numeric(is.na(notimmig))) %>% 
  mutate(immigjobs = 1-as.numeric(is.na(immigjobs))) %>% 
  mutate(immigatt = 1-as.numeric(is.na(immigatt))) %>% 
  mutate(menbetterleaders = 1-as.numeric(is.na(menbetterleaders))) %>% 
  mutate(univboy = 1-as.numeric(is.na(univboy))) %>% 
  mutate(menrighttojobs = 1-as.numeric(is.na(menrighttojobs))) %>% 
  mutate(homosexualitynotok = 1-as.numeric(is.na(homosexualitynotok))) %>% 
  mutate(abortionnotok = 1-as.numeric(is.na(abortionnotok))) %>% 
  mutate(euthannotok = 1-as.numeric(is.na(euthannotok))) %>% 
  mutate(incomediffs = 1-as.numeric(is.na(incomediffs)))%>% 
  mutate(econresponsibility = 1-as.numeric(is.na(econresponsibility))) %>% 
  mutate(ownershipbusiness = 1-as.numeric(is.na(ownershipbusiness))) %>% 
  mutate(competgood = 1-as.numeric(is.na(competgood))) %>% 
  mutate(hardwork = 1-as.numeric(is.na(hardwork))) %>% 
  mutate(wealthpositive = 1-as.numeric(is.na(wealthpositive))) %>% 
  mutate(sex = 1-is.na(sex)) %>% 
  mutate(ageyears = 1-as.numeric(is.na(ageyears))) %>% 
  mutate(collegedegree = 1-as.numeric(is.na(collegedegree))) %>% 
  mutate(hhincdecile = 1-as.numeric(is.na(hhincdecile))) %>% 
  mutate(confparties = 1-as.numeric(is.na(confparties))) %>% 
  mutate(confgov = 1-as.numeric(is.na(confgov))) %>% 
  mutate(confparliament = 1-as.numeric(is.na(confparliament))) %>% 
  mutate(politint = 1-as.numeric(is.na(politint))) %>% 
  mutate(politimp = 1-as.numeric(is.na(politimp))) %>% 
  mutate(finansat = 1-as.numeric(is.na(finansat))) 

#australia--------------------------------
c1<-west2[which(west$country=="Australia"),]

strongleader<- ( (length(c1$strongleader[c1$strongleader==1])*100)/length(c1$strongleader))
armyrule<- ( (length(c1$armyrule[c1$armyrule==1])*100)/length(c1$armyrule))
expertsdecide<- ( (length(c1$expertsdecide[c1$expertsdecide==1])*100)/length(c1$expertsdecide))
democpolbad<- ( (length(c1$democpolbad[c1$democpolbad==1])*100)/length(c1$democpolbad))
religimp<- ( (length(c1$religimp[c1$religimp==1])*100)/length(c1$religimp))
relchild<- ( (length(c1$relchild[c1$relchild==1])*100)/length(c1$relchild))
relatt<- ( (length(c1$relatt[c1$relatt==1])*100)/length(c1$relatt))
religid<- ( (length(c1$religid[c1$religid==1])*100)/length(c1$religid))
godimp<- ( (length(c1$godimp[c1$godimp==1])*100)/length(c1$godimp))
indepchildrev<- ( (length(c1$indepchildrev[c1$indepchildrev==1])*100)/length(c1$indepchildrev))
imagchildrev<- ( (length(c1$imagchildrev[c1$imagchildrev==1])*100)/length(c1$imagchildrev))
obedchild<- ( (length(c1$obedchild[c1$obedchild==1])*100)/length(c1$obedchild))
nototherrace<- ( (length(c1$nototherrace[c1$nototherrace==1])*100)/length(c1$nototherrace))
notimmig<- ( (length(c1$notimmig[c1$notimmig==1])*100)/length(c1$notimmig))
immigjobs<- ( (length(c1$immigjobs[c1$immigjobs==1])*100)/length(c1$immigjobs))
immigatt<- ( (length(c1$immigatt[c1$immigatt==1])*100)/length(c1$immigatt))
menbetterleaders<- ( (length(c1$menbetterleaders[c1$menbetterleaders==1])*100)/length(c1$menbetterleaders))
univboy<- ( (length(c1$univboy[c1$univboy==1])*100)/length(c1$univboy))
menrighttojobs<- ( (length(c1$menrighttojobs[c1$menrighttojobs==1])*100)/length(c1$menrighttojobs))
homosexualitynotok<- ( (length(c1$homosexualitynotok[c1$homosexualitynotok==1])*100)/length(c1$homosexualitynotok))
abortionnotok<- ( (length(c1$abortionnotok[c1$abortionnotok==1])*100)/length(c1$abortionnotok))
euthannotok<- ( (length(c1$euthannotok[c1$euthannotok==1])*100)/length(c1$euthannotok))
incomediffs<- ( (length(c1$incomediffs[c1$incomediffs==1])*100)/length(c1$incomediffs))
econresponsibility<- ( (length(c1$econresponsibility[c1$econresponsibility==1])*100)/length(c1$econresponsibility))
ownershipbusiness<- ( (length(c1$ownershipbusiness[c1$ownershipbusiness==1])*100)/length(c1$ownershipbusiness))
competgood<- ( (length(c1$competgood[c1$competgood==1])*100)/length(c1$competgood))
hardwork<- ( (length(c1$hardwork[c1$hardwork==1])*100)/length(c1$hardwork))
wealthpositive<- ( (length(c1$wealthpositive[c1$wealthpositive==1])*100)/length(c1$wealthpositive))
sex<- ( (length(c1$sex[c1$sex==1])*100)/length(c1$sex))
ageyears<- ( (length(c1$ageyears[c1$ageyears==1])*100)/length(c1$ageyears))
collegedegree<- ( (length(c1$collegedegree[c1$collegedegree==1])*100)/length(c1$collegedegree))
hhincdecile<- ( (length(c1$hhincdecile[c1$hhincdecile==1])*100)/length(c1$hhincdecile))
confparties<- ( (length(c1$confparties[c1$confparties==1])*100)/length(c1$confparties))
confgov<- ( (length(c1$confgov[c1$confgov==1])*100)/length(c1$confgov))
confparliament<- ( (length(c1$confparliament[c1$confparliament==1])*100)/length(c1$confparliament))
politint<- ( (length(c1$politint[c1$politint==1])*100)/length(c1$politint))
politimp<- ( (length(c1$politimp[c1$politimp==1])*100)/length(c1$politimp))
finansat<- ( (length(c1$finansat[c1$finansat==1])*100)/length(c1$finansat))

country1<- rbind(strongleader, armyrule, expertsdecide, democpolbad, religimp, relchild, relatt, religid, godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat)


#Canada--------------------------------
c2<-west2[which(west$country=="Canada"),]

strongleader<- ( (length(c2$strongleader[c2$strongleader==1])*100)/length(c2$strongleader))
armyrule<- ( (length(c2$armyrule[c2$armyrule==1])*100)/length(c2$armyrule))
expertsdecide<- ( (length(c2$expertsdecide[c2$expertsdecide==1])*100)/length(c2$expertsdecide))
democpolbad<- ( (length(c2$democpolbad[c2$democpolbad==1])*100)/length(c2$democpolbad))
religimp<- ( (length(c2$religimp[c2$religimp==1])*100)/length(c2$religimp))
relchild<- ( (length(c2$relchild[c2$relchild==1])*100)/length(c2$relchild))
relatt<- ( (length(c2$relatt[c2$relatt==1])*100)/length(c2$relatt))
religid<- ( (length(c2$religid[c2$religid==1])*100)/length(c2$religid))
godimp<- ( (length(c2$godimp[c2$godimp==1])*100)/length(c2$godimp))
indepchildrev<- ( (length(c2$indepchildrev[c2$indepchildrev==1])*100)/length(c2$indepchildrev))
imagchildrev<- ( (length(c2$imagchildrev[c2$imagchildrev==1])*100)/length(c2$imagchildrev))
obedchild<- ( (length(c2$obedchild[c2$obedchild==1])*100)/length(c2$obedchild))
nototherrace<- ( (length(c2$nototherrace[c2$nototherrace==1])*100)/length(c2$nototherrace))
notimmig<- ( (length(c2$notimmig[c2$notimmig==1])*100)/length(c2$notimmig))
immigjobs<- ( (length(c2$immigjobs[c2$immigjobs==1])*100)/length(c2$immigjobs))
immigatt<- ( (length(c2$immigatt[c2$immigatt==1])*100)/length(c2$immigatt))
menbetterleaders<- ( (length(c2$menbetterleaders[c2$menbetterleaders==1])*100)/length(c2$menbetterleaders))
univboy<- ( (length(c2$univboy[c2$univboy==1])*100)/length(c2$univboy))
menrighttojobs<- ( (length(c2$menrighttojobs[c2$menrighttojobs==1])*100)/length(c2$menrighttojobs))
homosexualitynotok<- ( (length(c2$homosexualitynotok[c2$homosexualitynotok==1])*100)/length(c2$homosexualitynotok))
abortionnotok<- ( (length(c2$abortionnotok[c2$abortionnotok==1])*100)/length(c2$abortionnotok))
euthannotok<- ( (length(c2$euthannotok[c2$euthannotok==1])*100)/length(c2$euthannotok))
incomediffs<- ( (length(c2$incomediffs[c2$incomediffs==1])*100)/length(c2$incomediffs))
econresponsibility<- ( (length(c2$econresponsibility[c2$econresponsibility==1])*100)/length(c2$econresponsibility))
ownershipbusiness<- ( (length(c2$ownershipbusiness[c2$ownershipbusiness==1])*100)/length(c2$ownershipbusiness))
competgood<- ( (length(c2$competgood[c2$competgood==1])*100)/length(c2$competgood))
hardwork<- ( (length(c2$hardwork[c2$hardwork==1])*100)/length(c2$hardwork))
wealthpositive<- ( (length(c2$wealthpositive[c2$wealthpositive==1])*100)/length(c2$wealthpositive))
sex<- ( (length(c2$sex[c2$sex==1])*100)/length(c2$sex))
ageyears<- ( (length(c2$ageyears[c2$ageyears==1])*100)/length(c2$ageyears))
collegedegree<- ( (length(c2$collegedegree[c2$collegedegree==1])*100)/length(c2$collegedegree))
hhincdecile<- ( (length(c2$hhincdecile[c2$hhincdecile==1])*100)/length(c2$hhincdecile))
confparties<- ( (length(c2$confparties[c2$confparties==1])*100)/length(c2$confparties))
confgov<- ( (length(c2$confgov[c2$confgov==1])*100)/length(c2$confgov))
confparliament<- ( (length(c2$confparliament[c2$confparliament==1])*100)/length(c2$confparliament))
politint<- ( (length(c2$politint[c2$politint==1])*100)/length(c2$politint))
politimp<- ( (length(c2$politimp[c2$politimp==1])*100)/length(c2$politimp))
finansat<- ( (length(c2$finansat[c2$finansat==1])*100)/length(c2$finansat))

country2<- rbind(strongleader, armyrule, expertsdecide, democpolbad, religimp, relchild, relatt, religid, godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat)


#Finland--------------------------------
c3<-west2[which(west$country=="Finland"),]

strongleader<- ( (length(c3$strongleader[c3$strongleader==1])*100)/length(c3$strongleader))
armyrule<- ( (length(c3$armyrule[c3$armyrule==1])*100)/length(c3$armyrule))
expertsdecide<- ( (length(c3$expertsdecide[c3$expertsdecide==1])*100)/length(c3$expertsdecide))
democpolbad<- ( (length(c3$democpolbad[c3$democpolbad==1])*100)/length(c3$democpolbad))
religimp<- ( (length(c3$religimp[c3$religimp==1])*100)/length(c3$religimp))
relchild<- ( (length(c3$relchild[c3$relchild==1])*100)/length(c3$relchild))
relatt<- ( (length(c3$relatt[c3$relatt==1])*100)/length(c3$relatt))
religid<- ( (length(c3$religid[c3$religid==1])*100)/length(c3$religid))
godimp<- ( (length(c3$godimp[c3$godimp==1])*100)/length(c3$godimp))
indepchildrev<- ( (length(c3$indepchildrev[c3$indepchildrev==1])*100)/length(c3$indepchildrev))
imagchildrev<- ( (length(c3$imagchildrev[c3$imagchildrev==1])*100)/length(c3$imagchildrev))
obedchild<- ( (length(c3$obedchild[c3$obedchild==1])*100)/length(c3$obedchild))
nototherrace<- ( (length(c3$nototherrace[c3$nototherrace==1])*100)/length(c3$nototherrace))
notimmig<- ( (length(c3$notimmig[c3$notimmig==1])*100)/length(c3$notimmig))
immigjobs<- ( (length(c3$immigjobs[c3$immigjobs==1])*100)/length(c3$immigjobs))
immigatt<- ( (length(c3$immigatt[c3$immigatt==1])*100)/length(c3$immigatt))
menbetterleaders<- ( (length(c3$menbetterleaders[c3$menbetterleaders==1])*100)/length(c3$menbetterleaders))
univboy<- ( (length(c3$univboy[c3$univboy==1])*100)/length(c3$univboy))
menrighttojobs<- ( (length(c3$menrighttojobs[c3$menrighttojobs==1])*100)/length(c3$menrighttojobs))
homosexualitynotok<- ( (length(c3$homosexualitynotok[c3$homosexualitynotok==1])*100)/length(c3$homosexualitynotok))
abortionnotok<- ( (length(c3$abortionnotok[c3$abortionnotok==1])*100)/length(c3$abortionnotok))
euthannotok<- ( (length(c3$euthannotok[c3$euthannotok==1])*100)/length(c3$euthannotok))
incomediffs<- ( (length(c3$incomediffs[c3$incomediffs==1])*100)/length(c3$incomediffs))
econresponsibility<- ( (length(c3$econresponsibility[c3$econresponsibility==1])*100)/length(c3$econresponsibility))
ownershipbusiness<- ( (length(c3$ownershipbusiness[c3$ownershipbusiness==1])*100)/length(c3$ownershipbusiness))
competgood<- ( (length(c3$competgood[c3$competgood==1])*100)/length(c3$competgood))
hardwork<- ( (length(c3$hardwork[c3$hardwork==1])*100)/length(c3$hardwork))
wealthpositive<- ( (length(c3$wealthpositive[c3$wealthpositive==1])*100)/length(c3$wealthpositive))
sex<- ( (length(c3$sex[c3$sex==1])*100)/length(c3$sex))
ageyears<- ( (length(c3$ageyears[c3$ageyears==1])*100)/length(c3$ageyears))
collegedegree<- ( (length(c3$collegedegree[c3$collegedegree==1])*100)/length(c3$collegedegree))
hhincdecile<- ( (length(c3$hhincdecile[c3$hhincdecile==1])*100)/length(c3$hhincdecile))
confparties<- ( (length(c3$confparties[c3$confparties==1])*100)/length(c3$confparties))
confgov<- ( (length(c3$confgov[c3$confgov==1])*100)/length(c3$confgov))
confparliament<- ( (length(c3$confparliament[c3$confparliament==1])*100)/length(c3$confparliament))
politint<- ( (length(c3$politint[c3$politint==1])*100)/length(c3$politint))
politimp<- ( (length(c3$politimp[c3$politimp==1])*100)/length(c3$politimp))
finansat<- ( (length(c3$finansat[c3$finansat==1])*100)/length(c3$finansat))

country3<- rbind(strongleader, armyrule, expertsdecide, democpolbad, religimp, relchild, relatt, religid, godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat)


#France--------------------------------
c4<-west2[which(west$country=="France"),]

strongleader<- ( (length(c4$strongleader[c4$strongleader==1])*100)/length(c4$strongleader))
armyrule<- ( (length(c4$armyrule[c4$armyrule==1])*100)/length(c4$armyrule))
expertsdecide<- ( (length(c4$expertsdecide[c4$expertsdecide==1])*100)/length(c4$expertsdecide))
democpolbad<- ( (length(c4$democpolbad[c4$democpolbad==1])*100)/length(c4$democpolbad))
religimp<- ( (length(c4$religimp[c4$religimp==1])*100)/length(c4$religimp))
relchild<- ( (length(c4$relchild[c4$relchild==1])*100)/length(c4$relchild))
relatt<- ( (length(c4$relatt[c4$relatt==1])*100)/length(c4$relatt))
religid<- ( (length(c4$religid[c4$religid==1])*100)/length(c4$religid))
godimp<- ( (length(c4$godimp[c4$godimp==1])*100)/length(c4$godimp))
indepchildrev<- ( (length(c4$indepchildrev[c4$indepchildrev==1])*100)/length(c4$indepchildrev))
imagchildrev<- ( (length(c4$imagchildrev[c4$imagchildrev==1])*100)/length(c4$imagchildrev))
obedchild<- ( (length(c4$obedchild[c4$obedchild==1])*100)/length(c4$obedchild))
nototherrace<- ( (length(c4$nototherrace[c4$nototherrace==1])*100)/length(c4$nototherrace))
notimmig<- ( (length(c4$notimmig[c4$notimmig==1])*100)/length(c4$notimmig))
immigjobs<- ( (length(c4$immigjobs[c4$immigjobs==1])*100)/length(c4$immigjobs))
immigatt<- ( (length(c4$immigatt[c4$immigatt==1])*100)/length(c4$immigatt))
menbetterleaders<- ( (length(c4$menbetterleaders[c4$menbetterleaders==1])*100)/length(c4$menbetterleaders))
univboy<- ( (length(c4$univboy[c4$univboy==1])*100)/length(c4$univboy))
menrighttojobs<- ( (length(c4$menrighttojobs[c4$menrighttojobs==1])*100)/length(c4$menrighttojobs))
homosexualitynotok<- ( (length(c4$homosexualitynotok[c4$homosexualitynotok==1])*100)/length(c4$homosexualitynotok))
abortionnotok<- ( (length(c4$abortionnotok[c4$abortionnotok==1])*100)/length(c4$abortionnotok))
euthannotok<- ( (length(c4$euthannotok[c4$euthannotok==1])*100)/length(c4$euthannotok))
incomediffs<- ( (length(c4$incomediffs[c4$incomediffs==1])*100)/length(c4$incomediffs))
econresponsibility<- ( (length(c4$econresponsibility[c4$econresponsibility==1])*100)/length(c4$econresponsibility))
ownershipbusiness<- ( (length(c4$ownershipbusiness[c4$ownershipbusiness==1])*100)/length(c4$ownershipbusiness))
competgood<- ( (length(c4$competgood[c4$competgood==1])*100)/length(c4$competgood))
hardwork<- ( (length(c4$hardwork[c4$hardwork==1])*100)/length(c4$hardwork))
wealthpositive<- ( (length(c4$wealthpositive[c4$wealthpositive==1])*100)/length(c4$wealthpositive))
sex<- ( (length(c4$sex[c4$sex==1])*100)/length(c4$sex))
ageyears<- ( (length(c4$ageyears[c4$ageyears==1])*100)/length(c4$ageyears))
collegedegree<- ( (length(c4$collegedegree[c4$collegedegree==1])*100)/length(c4$collegedegree))
hhincdecile<- ( (length(c4$hhincdecile[c4$hhincdecile==1])*100)/length(c4$hhincdecile))
confparties<- ( (length(c4$confparties[c4$confparties==1])*100)/length(c4$confparties))
confgov<- ( (length(c4$confgov[c4$confgov==1])*100)/length(c4$confgov))
confparliament<- ( (length(c4$confparliament[c4$confparliament==1])*100)/length(c4$confparliament))
politint<- ( (length(c4$politint[c4$politint==1])*100)/length(c4$politint))
politimp<- ( (length(c4$politimp[c4$politimp==1])*100)/length(c4$politimp))
finansat<- ( (length(c4$finansat[c4$finansat==1])*100)/length(c4$finansat))

country4<- rbind(strongleader, armyrule, expertsdecide, democpolbad, religimp, relchild, relatt, religid, godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat)



#Germany--------------------------------
c5<-west2[which(west$country=="Germany"),]

strongleader<- ( (length(c5$strongleader[c5$strongleader==1])*100)/length(c5$strongleader))
armyrule<- ( (length(c5$armyrule[c5$armyrule==1])*100)/length(c5$armyrule))
expertsdecide<- ( (length(c5$expertsdecide[c5$expertsdecide==1])*100)/length(c5$expertsdecide))
democpolbad<- ( (length(c5$democpolbad[c5$democpolbad==1])*100)/length(c5$democpolbad))
religimp<- ( (length(c5$religimp[c5$religimp==1])*100)/length(c5$religimp))
relchild<- ( (length(c5$relchild[c5$relchild==1])*100)/length(c5$relchild))
relatt<- ( (length(c5$relatt[c5$relatt==1])*100)/length(c5$relatt))
religid<- ( (length(c5$religid[c5$religid==1])*100)/length(c5$religid))
godimp<- ( (length(c5$godimp[c5$godimp==1])*100)/length(c5$godimp))
indepchildrev<- ( (length(c5$indepchildrev[c5$indepchildrev==1])*100)/length(c5$indepchildrev))
imagchildrev<- ( (length(c5$imagchildrev[c5$imagchildrev==1])*100)/length(c5$imagchildrev))
obedchild<- ( (length(c5$obedchild[c5$obedchild==1])*100)/length(c5$obedchild))
nototherrace<- ( (length(c5$nototherrace[c5$nototherrace==1])*100)/length(c5$nototherrace))
notimmig<- ( (length(c5$notimmig[c5$notimmig==1])*100)/length(c5$notimmig))
immigjobs<- ( (length(c5$immigjobs[c5$immigjobs==1])*100)/length(c5$immigjobs))
immigatt<- ( (length(c5$immigatt[c5$immigatt==1])*100)/length(c5$immigatt))
menbetterleaders<- ( (length(c5$menbetterleaders[c5$menbetterleaders==1])*100)/length(c5$menbetterleaders))
univboy<- ( (length(c5$univboy[c5$univboy==1])*100)/length(c5$univboy))
menrighttojobs<- ( (length(c5$menrighttojobs[c5$menrighttojobs==1])*100)/length(c5$menrighttojobs))
homosexualitynotok<- ( (length(c5$homosexualitynotok[c5$homosexualitynotok==1])*100)/length(c5$homosexualitynotok))
abortionnotok<- ( (length(c5$abortionnotok[c5$abortionnotok==1])*100)/length(c5$abortionnotok))
euthannotok<- ( (length(c5$euthannotok[c5$euthannotok==1])*100)/length(c5$euthannotok))
incomediffs<- ( (length(c5$incomediffs[c5$incomediffs==1])*100)/length(c5$incomediffs))
econresponsibility<- ( (length(c5$econresponsibility[c5$econresponsibility==1])*100)/length(c5$econresponsibility))
ownershipbusiness<- ( (length(c5$ownershipbusiness[c5$ownershipbusiness==1])*100)/length(c5$ownershipbusiness))
competgood<- ( (length(c5$competgood[c5$competgood==1])*100)/length(c5$competgood))
hardwork<- ( (length(c5$hardwork[c5$hardwork==1])*100)/length(c5$hardwork))
wealthpositive<- ( (length(c5$wealthpositive[c5$wealthpositive==1])*100)/length(c5$wealthpositive))
sex<- ( (length(c5$sex[c5$sex==1])*100)/length(c5$sex))
ageyears<- ( (length(c5$ageyears[c5$ageyears==1])*100)/length(c5$ageyears))
collegedegree<- ( (length(c5$collegedegree[c5$collegedegree==1])*100)/length(c5$collegedegree))
hhincdecile<- ( (length(c5$hhincdecile[c5$hhincdecile==1])*100)/length(c5$hhincdecile))
confparties<- ( (length(c5$confparties[c5$confparties==1])*100)/length(c5$confparties))
confgov<- ( (length(c5$confgov[c5$confgov==1])*100)/length(c5$confgov))
confparliament<- ( (length(c5$confparliament[c5$confparliament==1])*100)/length(c5$confparliament))
politint<- ( (length(c5$politint[c5$politint==1])*100)/length(c5$politint))
politimp<- ( (length(c5$politimp[c5$politimp==1])*100)/length(c5$politimp))
finansat<- ( (length(c5$finansat[c5$finansat==1])*100)/length(c5$finansat))

country5<- rbind(strongleader, armyrule, expertsdecide, democpolbad, religimp, relchild, relatt, religid, godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat)


#Great Brittain--------------------------------
c6<-west2[which(west$country=="Great Britain"),]
strongleader<- ( (length(c6$strongleader[c6$strongleader==1])*100)/length(c6$strongleader))
armyrule<- ( (length(c6$armyrule[c6$armyrule==1])*100)/length(c6$armyrule))
expertsdecide<- ( (length(c6$expertsdecide[c6$expertsdecide==1])*100)/length(c6$expertsdecide))
democpolbad<- ( (length(c6$democpolbad[c6$democpolbad==1])*100)/length(c6$democpolbad))
religimp<- ( (length(c6$religimp[c6$religimp==1])*100)/length(c6$religimp))
relchild<- ( (length(c6$relchild[c6$relchild==1])*100)/length(c6$relchild))
relatt<- ( (length(c6$relatt[c6$relatt==1])*100)/length(c6$relatt))
religid<- ( (length(c6$religid[c6$religid==1])*100)/length(c6$religid))
godimp<- ( (length(c6$godimp[c6$godimp==1])*100)/length(c6$godimp))
indepchildrev<- ( (length(c6$indepchildrev[c6$indepchildrev==1])*100)/length(c6$indepchildrev))
imagchildrev<- ( (length(c6$imagchildrev[c6$imagchildrev==1])*100)/length(c6$imagchildrev))
obedchild<- ( (length(c6$obedchild[c6$obedchild==1])*100)/length(c6$obedchild))
nototherrace<- ( (length(c6$nototherrace[c6$nototherrace==1])*100)/length(c6$nototherrace))
notimmig<- ( (length(c6$notimmig[c6$notimmig==1])*100)/length(c6$notimmig))
immigjobs<- ( (length(c6$immigjobs[c6$immigjobs==1])*100)/length(c6$immigjobs))
immigatt<- ( (length(c6$immigatt[c6$immigatt==1])*100)/length(c6$immigatt))
menbetterleaders<- ( (length(c6$menbetterleaders[c6$menbetterleaders==1])*100)/length(c6$menbetterleaders))
univboy<- ( (length(c6$univboy[c6$univboy==1])*100)/length(c6$univboy))
menrighttojobs<- ( (length(c6$menrighttojobs[c6$menrighttojobs==1])*100)/length(c6$menrighttojobs))
homosexualitynotok<- ( (length(c6$homosexualitynotok[c6$homosexualitynotok==1])*100)/length(c6$homosexualitynotok))
abortionnotok<- ( (length(c6$abortionnotok[c6$abortionnotok==1])*100)/length(c6$abortionnotok))
euthannotok<- ( (length(c6$euthannotok[c6$euthannotok==1])*100)/length(c6$euthannotok))
incomediffs<- ( (length(c6$incomediffs[c6$incomediffs==1])*100)/length(c6$incomediffs))
econresponsibility<- ( (length(c6$econresponsibility[c6$econresponsibility==1])*100)/length(c6$econresponsibility))
ownershipbusiness<- ( (length(c6$ownershipbusiness[c6$ownershipbusiness==1])*100)/length(c6$ownershipbusiness))
competgood<- ( (length(c6$competgood[c6$competgood==1])*100)/length(c6$competgood))
hardwork<- ( (length(c6$hardwork[c6$hardwork==1])*100)/length(c6$hardwork))
wealthpositive<- ( (length(c6$wealthpositive[c6$wealthpositive==1])*100)/length(c6$wealthpositive))
sex<- ( (length(c6$sex[c6$sex==1])*100)/length(c6$sex))
ageyears<- ( (length(c6$ageyears[c6$ageyears==1])*100)/length(c6$ageyears))
collegedegree<- ( (length(c6$collegedegree[c6$collegedegree==1])*100)/length(c6$collegedegree))
hhincdecile<- ( (length(c6$hhincdecile[c6$hhincdecile==1])*100)/length(c6$hhincdecile))
confparties<- ( (length(c6$confparties[c6$confparties==1])*100)/length(c6$confparties))
confgov<- ( (length(c6$confgov[c6$confgov==1])*100)/length(c6$confgov))
confparliament<- ( (length(c6$confparliament[c6$confparliament==1])*100)/length(c6$confparliament))
politint<- ( (length(c6$politint[c6$politint==1])*100)/length(c6$politint))
politimp<- ( (length(c6$politimp[c6$politimp==1])*100)/length(c6$politimp))
finansat<- ( (length(c6$finansat[c6$finansat==1])*100)/length(c6$finansat))

country6<- rbind(strongleader, armyrule, expertsdecide, democpolbad, religimp, relchild, relatt, religid, godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat)


#Italy--------------------------------
c7<-west2[which(west$country=="Italy"),]

strongleader<- ( (length(c7$strongleader[c7$strongleader==1])*100)/length(c7$strongleader))
armyrule<- ( (length(c7$armyrule[c7$armyrule==1])*100)/length(c7$armyrule))
expertsdecide<- ( (length(c7$expertsdecide[c7$expertsdecide==1])*100)/length(c7$expertsdecide))
democpolbad<- ( (length(c7$democpolbad[c7$democpolbad==1])*100)/length(c7$democpolbad))
religimp<- ( (length(c7$religimp[c7$religimp==1])*100)/length(c7$religimp))
relchild<- ( (length(c7$relchild[c7$relchild==1])*100)/length(c7$relchild))
relatt<- ( (length(c7$relatt[c7$relatt==1])*100)/length(c7$relatt))
religid<- ( (length(c7$religid[c7$religid==1])*100)/length(c7$religid))
godimp<- ( (length(c7$godimp[c7$godimp==1])*100)/length(c7$godimp))
indepchildrev<- ( (length(c7$indepchildrev[c7$indepchildrev==1])*100)/length(c7$indepchildrev))
imagchildrev<- ( (length(c7$imagchildrev[c7$imagchildrev==1])*100)/length(c7$imagchildrev))
obedchild<- ( (length(c7$obedchild[c7$obedchild==1])*100)/length(c7$obedchild))
nototherrace<- ( (length(c7$nototherrace[c7$nototherrace==1])*100)/length(c7$nototherrace))
notimmig<- ( (length(c7$notimmig[c7$notimmig==1])*100)/length(c7$notimmig))
immigjobs<- ( (length(c7$immigjobs[c7$immigjobs==1])*100)/length(c7$immigjobs))
immigatt<- ( (length(c7$immigatt[c7$immigatt==1])*100)/length(c7$immigatt))
menbetterleaders<- ( (length(c7$menbetterleaders[c7$menbetterleaders==1])*100)/length(c7$menbetterleaders))
univboy<- ( (length(c7$univboy[c7$univboy==1])*100)/length(c7$univboy))
menrighttojobs<- ( (length(c7$menrighttojobs[c7$menrighttojobs==1])*100)/length(c7$menrighttojobs))
homosexualitynotok<- ( (length(c7$homosexualitynotok[c7$homosexualitynotok==1])*100)/length(c7$homosexualitynotok))
abortionnotok<- ( (length(c7$abortionnotok[c7$abortionnotok==1])*100)/length(c7$abortionnotok))
euthannotok<- ( (length(c7$euthannotok[c7$euthannotok==1])*100)/length(c7$euthannotok))
incomediffs<- ( (length(c7$incomediffs[c7$incomediffs==1])*100)/length(c7$incomediffs))
econresponsibility<- ( (length(c7$econresponsibility[c7$econresponsibility==1])*100)/length(c7$econresponsibility))
ownershipbusiness<- ( (length(c7$ownershipbusiness[c7$ownershipbusiness==1])*100)/length(c7$ownershipbusiness))
competgood<- ( (length(c7$competgood[c7$competgood==1])*100)/length(c7$competgood))
hardwork<- ( (length(c7$hardwork[c7$hardwork==1])*100)/length(c7$hardwork))
wealthpositive<- ( (length(c7$wealthpositive[c7$wealthpositive==1])*100)/length(c7$wealthpositive))
sex<- ( (length(c7$sex[c7$sex==1])*100)/length(c7$sex))
ageyears<- ( (length(c7$ageyears[c7$ageyears==1])*100)/length(c7$ageyears))
collegedegree<- ( (length(c7$collegedegree[c7$collegedegree==1])*100)/length(c7$collegedegree))
hhincdecile<- ( (length(c7$hhincdecile[c7$hhincdecile==1])*100)/length(c7$hhincdecile))
confparties<- ( (length(c7$confparties[c7$confparties==1])*100)/length(c7$confparties))
confgov<- ( (length(c7$confgov[c7$confgov==1])*100)/length(c7$confgov))
confparliament<- ( (length(c7$confparliament[c7$confparliament==1])*100)/length(c7$confparliament))
politint<- ( (length(c7$politint[c7$politint==1])*100)/length(c7$politint))
politimp<- ( (length(c7$politimp[c7$politimp==1])*100)/length(c7$politimp))
finansat<- ( (length(c7$finansat[c7$finansat==1])*100)/length(c7$finansat))

country7<- rbind(strongleader, armyrule, expertsdecide, democpolbad, religimp, relchild, relatt, religid, godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat)


#Netherlands--------------------------------
c8<-west2[which(west$country=="Netherlands"),]

strongleader<- ( (length(c8$strongleader[c8$strongleader==1])*100)/length(c8$strongleader))
armyrule<- ( (length(c8$armyrule[c8$armyrule==1])*100)/length(c8$armyrule))
expertsdecide<- ( (length(c8$expertsdecide[c8$expertsdecide==1])*100)/length(c8$expertsdecide))
democpolbad<- ( (length(c8$democpolbad[c8$democpolbad==1])*100)/length(c8$democpolbad))
religimp<- ( (length(c8$religimp[c8$religimp==1])*100)/length(c8$religimp))
relchild<- ( (length(c8$relchild[c8$relchild==1])*100)/length(c8$relchild))
relatt<- ( (length(c8$relatt[c8$relatt==1])*100)/length(c8$relatt))
religid<- ( (length(c8$religid[c8$religid==1])*100)/length(c8$religid))
godimp<- ( (length(c8$godimp[c8$godimp==1])*100)/length(c8$godimp))
indepchildrev<- ( (length(c8$indepchildrev[c8$indepchildrev==1])*100)/length(c8$indepchildrev))
imagchildrev<- ( (length(c8$imagchildrev[c8$imagchildrev==1])*100)/length(c8$imagchildrev))
obedchild<- ( (length(c8$obedchild[c8$obedchild==1])*100)/length(c8$obedchild))
nototherrace<- ( (length(c8$nototherrace[c8$nototherrace==1])*100)/length(c8$nototherrace))
notimmig<- ( (length(c8$notimmig[c8$notimmig==1])*100)/length(c8$notimmig))
immigjobs<- ( (length(c8$immigjobs[c8$immigjobs==1])*100)/length(c8$immigjobs))
immigatt<- ( (length(c8$immigatt[c8$immigatt==1])*100)/length(c8$immigatt))
menbetterleaders<- ( (length(c8$menbetterleaders[c8$menbetterleaders==1])*100)/length(c8$menbetterleaders))
univboy<- ( (length(c8$univboy[c8$univboy==1])*100)/length(c8$univboy))
menrighttojobs<- ( (length(c8$menrighttojobs[c8$menrighttojobs==1])*100)/length(c8$menrighttojobs))
homosexualitynotok<- ( (length(c8$homosexualitynotok[c8$homosexualitynotok==1])*100)/length(c8$homosexualitynotok))
abortionnotok<- ( (length(c8$abortionnotok[c8$abortionnotok==1])*100)/length(c8$abortionnotok))
euthannotok<- ( (length(c8$euthannotok[c8$euthannotok==1])*100)/length(c8$euthannotok))
incomediffs<- ( (length(c8$incomediffs[c8$incomediffs==1])*100)/length(c8$incomediffs))
econresponsibility<- ( (length(c8$econresponsibility[c8$econresponsibility==1])*100)/length(c8$econresponsibility))
ownershipbusiness<- ( (length(c8$ownershipbusiness[c8$ownershipbusiness==1])*100)/length(c8$ownershipbusiness))
competgood<- ( (length(c8$competgood[c8$competgood==1])*100)/length(c8$competgood))
hardwork<- ( (length(c8$hardwork[c8$hardwork==1])*100)/length(c8$hardwork))
wealthpositive<- ( (length(c8$wealthpositive[c8$wealthpositive==1])*100)/length(c8$wealthpositive))
sex<- ( (length(c8$sex[c8$sex==1])*100)/length(c8$sex))
ageyears<- ( (length(c8$ageyears[c8$ageyears==1])*100)/length(c8$ageyears))
collegedegree<- ( (length(c8$collegedegree[c8$collegedegree==1])*100)/length(c8$collegedegree))
hhincdecile<- ( (length(c8$hhincdecile[c8$hhincdecile==1])*100)/length(c8$hhincdecile))
confparties<- ( (length(c8$confparties[c8$confparties==1])*100)/length(c8$confparties))
confgov<- ( (length(c8$confgov[c8$confgov==1])*100)/length(c8$confgov))
confparliament<- ( (length(c8$confparliament[c8$confparliament==1])*100)/length(c8$confparliament))
politint<- ( (length(c8$politint[c8$politint==1])*100)/length(c8$politint))
politimp<- ( (length(c8$politimp[c8$politimp==1])*100)/length(c8$politimp))
finansat<- ( (length(c8$finansat[c8$finansat==1])*100)/length(c8$finansat))

country8<- rbind(strongleader, armyrule, expertsdecide, democpolbad, religimp, relchild, relatt, religid, godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat)


#New Zealand--------------------------------
c9<-west2[which(west$country=="New Zealand"),]

strongleader<- ( (length(c9$strongleader[c9$strongleader==1])*100)/length(c9$strongleader))
armyrule<- ( (length(c9$armyrule[c9$armyrule==1])*100)/length(c9$armyrule))
expertsdecide<- ( (length(c9$expertsdecide[c9$expertsdecide==1])*100)/length(c9$expertsdecide))
democpolbad<- ( (length(c9$democpolbad[c9$democpolbad==1])*100)/length(c9$democpolbad))
religimp<- ( (length(c9$religimp[c9$religimp==1])*100)/length(c9$religimp))
relchild<- ( (length(c9$relchild[c9$relchild==1])*100)/length(c9$relchild))
relatt<- ( (length(c9$relatt[c9$relatt==1])*100)/length(c9$relatt))
religid<- ( (length(c9$religid[c9$religid==1])*100)/length(c9$religid))
godimp<- ( (length(c9$godimp[c9$godimp==1])*100)/length(c9$godimp))
indepchildrev<- ( (length(c9$indepchildrev[c9$indepchildrev==1])*100)/length(c9$indepchildrev))
imagchildrev<- ( (length(c9$imagchildrev[c9$imagchildrev==1])*100)/length(c9$imagchildrev))
obedchild<- ( (length(c9$obedchild[c9$obedchild==1])*100)/length(c9$obedchild))
nototherrace<- ( (length(c9$nototherrace[c9$nototherrace==1])*100)/length(c9$nototherrace))
notimmig<- ( (length(c9$notimmig[c9$notimmig==1])*100)/length(c9$notimmig))
immigjobs<- ( (length(c9$immigjobs[c9$immigjobs==1])*100)/length(c9$immigjobs))
immigatt<- ( (length(c9$immigatt[c9$immigatt==1])*100)/length(c9$immigatt))
menbetterleaders<- ( (length(c9$menbetterleaders[c9$menbetterleaders==1])*100)/length(c9$menbetterleaders))
univboy<- ( (length(c9$univboy[c9$univboy==1])*100)/length(c9$univboy))
menrighttojobs<- ( (length(c9$menrighttojobs[c9$menrighttojobs==1])*100)/length(c9$menrighttojobs))
homosexualitynotok<- ( (length(c9$homosexualitynotok[c9$homosexualitynotok==1])*100)/length(c9$homosexualitynotok))
abortionnotok<- ( (length(c9$abortionnotok[c9$abortionnotok==1])*100)/length(c9$abortionnotok))
euthannotok<- ( (length(c9$euthannotok[c9$euthannotok==1])*100)/length(c9$euthannotok))
incomediffs<- ( (length(c9$incomediffs[c9$incomediffs==1])*100)/length(c9$incomediffs))
econresponsibility<- ( (length(c9$econresponsibility[c9$econresponsibility==1])*100)/length(c9$econresponsibility))
ownershipbusiness<- ( (length(c9$ownershipbusiness[c9$ownershipbusiness==1])*100)/length(c9$ownershipbusiness))
competgood<- ( (length(c9$competgood[c9$competgood==1])*100)/length(c9$competgood))
hardwork<- ( (length(c9$hardwork[c9$hardwork==1])*100)/length(c9$hardwork))
wealthpositive<- ( (length(c9$wealthpositive[c9$wealthpositive==1])*100)/length(c9$wealthpositive))
sex<- ( (length(c9$sex[c9$sex==1])*100)/length(c9$sex))
ageyears<- ( (length(c9$ageyears[c9$ageyears==1])*100)/length(c9$ageyears))
collegedegree<- ( (length(c9$collegedegree[c9$collegedegree==1])*100)/length(c9$collegedegree))
hhincdecile<- ( (length(c9$hhincdecile[c9$hhincdecile==1])*100)/length(c9$hhincdecile))
confparties<- ( (length(c9$confparties[c9$confparties==1])*100)/length(c9$confparties))
confgov<- ( (length(c9$confgov[c9$confgov==1])*100)/length(c9$confgov))
confparliament<- ( (length(c9$confparliament[c9$confparliament==1])*100)/length(c9$confparliament))
politint<- ( (length(c9$politint[c9$politint==1])*100)/length(c9$politint))
politimp<- ( (length(c9$politimp[c9$politimp==1])*100)/length(c9$politimp))
finansat<- ( (length(c9$finansat[c9$finansat==1])*100)/length(c9$finansat))

country9<- rbind(strongleader, armyrule, expertsdecide, democpolbad, religimp, relchild, relatt, religid, godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat)


#NOrway--------------------------------
c10<-west2[which(west$country=="Norway"),]

strongleader<- ( (length(c10$strongleader[c10$strongleader==1])*100)/length(c10$strongleader))
armyrule<- ( (length(c10$armyrule[c10$armyrule==1])*100)/length(c10$armyrule))
expertsdecide<- ( (length(c10$expertsdecide[c10$expertsdecide==1])*100)/length(c10$expertsdecide))
democpolbad<- ( (length(c10$democpolbad[c10$democpolbad==1])*100)/length(c10$democpolbad))
religimp<- ( (length(c10$religimp[c10$religimp==1])*100)/length(c10$religimp))
relchild<- ( (length(c10$relchild[c10$relchild==1])*100)/length(c10$relchild))
relatt<- ( (length(c10$relatt[c10$relatt==1])*100)/length(c10$relatt))
religid<- ( (length(c10$religid[c10$religid==1])*100)/length(c10$religid))
godimp<- ( (length(c10$godimp[c10$godimp==1])*100)/length(c10$godimp))
indepchildrev<- ( (length(c10$indepchildrev[c10$indepchildrev==1])*100)/length(c10$indepchildrev))
imagchildrev<- ( (length(c10$imagchildrev[c10$imagchildrev==1])*100)/length(c10$imagchildrev))
obedchild<- ( (length(c10$obedchild[c10$obedchild==1])*100)/length(c10$obedchild))
nototherrace<- ( (length(c10$nototherrace[c10$nototherrace==1])*100)/length(c10$nototherrace))
notimmig<- ( (length(c10$notimmig[c10$notimmig==1])*100)/length(c10$notimmig))
immigjobs<- ( (length(c10$immigjobs[c10$immigjobs==1])*100)/length(c10$immigjobs))
immigatt<- ( (length(c10$immigatt[c10$immigatt==1])*100)/length(c10$immigatt))
menbetterleaders<- ( (length(c10$menbetterleaders[c10$menbetterleaders==1])*100)/length(c10$menbetterleaders))
univboy<- ( (length(c10$univboy[c10$univboy==1])*100)/length(c10$univboy))
menrighttojobs<- ( (length(c10$menrighttojobs[c10$menrighttojobs==1])*100)/length(c10$menrighttojobs))
homosexualitynotok<- ( (length(c10$homosexualitynotok[c10$homosexualitynotok==1])*100)/length(c10$homosexualitynotok))
abortionnotok<- ( (length(c10$abortionnotok[c10$abortionnotok==1])*100)/length(c10$abortionnotok))
euthannotok<- ( (length(c10$euthannotok[c10$euthannotok==1])*100)/length(c10$euthannotok))
incomediffs<- ( (length(c10$incomediffs[c10$incomediffs==1])*100)/length(c10$incomediffs))
econresponsibility<- ( (length(c10$econresponsibility[c10$econresponsibility==1])*100)/length(c10$econresponsibility))
ownershipbusiness<- ( (length(c10$ownershipbusiness[c10$ownershipbusiness==1])*100)/length(c10$ownershipbusiness))
competgood<- ( (length(c10$competgood[c10$competgood==1])*100)/length(c10$competgood))
hardwork<- ( (length(c10$hardwork[c10$hardwork==1])*100)/length(c10$hardwork))
wealthpositive<- ( (length(c10$wealthpositive[c10$wealthpositive==1])*100)/length(c10$wealthpositive))
sex<- ( (length(c10$sex[c10$sex==1])*100)/length(c10$sex))
ageyears<- ( (length(c10$ageyears[c10$ageyears==1])*100)/length(c10$ageyears))
collegedegree<- ( (length(c10$collegedegree[c10$collegedegree==1])*100)/length(c10$collegedegree))
hhincdecile<- ( (length(c10$hhincdecile[c10$hhincdecile==1])*100)/length(c10$hhincdecile))
confparties<- ( (length(c10$confparties[c10$confparties==1])*100)/length(c10$confparties))
confgov<- ( (length(c10$confgov[c10$confgov==1])*100)/length(c10$confgov))
confparliament<- ( (length(c10$confparliament[c10$confparliament==1])*100)/length(c10$confparliament))
politint<- ( (length(c10$politint[c10$politint==1])*100)/length(c10$politint))
politimp<- ( (length(c10$politimp[c10$politimp==1])*100)/length(c10$politimp))
finansat<- ( (length(c10$finansat[c10$finansat==1])*100)/length(c10$finansat))

country10<- rbind(strongleader, armyrule, expertsdecide, democpolbad, religimp, relchild, relatt, religid, godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat)


#Spain--------------------------------
c11<-west2[which(west$country=="Spain"),]

strongleader<- ( (length(c11$strongleader[c11$strongleader==1])*100)/length(c11$strongleader))
armyrule<- ( (length(c11$armyrule[c11$armyrule==1])*100)/length(c11$armyrule))
expertsdecide<- ( (length(c11$expertsdecide[c11$expertsdecide==1])*100)/length(c11$expertsdecide))
democpolbad<- ( (length(c11$democpolbad[c11$democpolbad==1])*100)/length(c11$democpolbad))
religimp<- ( (length(c11$religimp[c11$religimp==1])*100)/length(c11$religimp))
relchild<- ( (length(c11$relchild[c11$relchild==1])*100)/length(c11$relchild))
relatt<- ( (length(c11$relatt[c11$relatt==1])*100)/length(c11$relatt))
religid<- ( (length(c11$religid[c11$religid==1])*100)/length(c11$religid))
godimp<- ( (length(c11$godimp[c11$godimp==1])*100)/length(c11$godimp))
indepchildrev<- ( (length(c11$indepchildrev[c11$indepchildrev==1])*100)/length(c11$indepchildrev))
imagchildrev<- ( (length(c11$imagchildrev[c11$imagchildrev==1])*100)/length(c11$imagchildrev))
obedchild<- ( (length(c11$obedchild[c11$obedchild==1])*100)/length(c11$obedchild))
nototherrace<- ( (length(c11$nototherrace[c11$nototherrace==1])*100)/length(c11$nototherrace))
notimmig<- ( (length(c11$notimmig[c11$notimmig==1])*100)/length(c11$notimmig))
immigjobs<- ( (length(c11$immigjobs[c11$immigjobs==1])*100)/length(c11$immigjobs))
immigatt<- ( (length(c11$immigatt[c11$immigatt==1])*100)/length(c11$immigatt))
menbetterleaders<- ( (length(c11$menbetterleaders[c11$menbetterleaders==1])*100)/length(c11$menbetterleaders))
univboy<- ( (length(c11$univboy[c11$univboy==1])*100)/length(c11$univboy))
menrighttojobs<- ( (length(c11$menrighttojobs[c11$menrighttojobs==1])*100)/length(c11$menrighttojobs))
homosexualitynotok<- ( (length(c11$homosexualitynotok[c11$homosexualitynotok==1])*100)/length(c11$homosexualitynotok))
abortionnotok<- ( (length(c11$abortionnotok[c11$abortionnotok==1])*100)/length(c11$abortionnotok))
euthannotok<- ( (length(c11$euthannotok[c11$euthannotok==1])*100)/length(c11$euthannotok))
incomediffs<- ( (length(c11$incomediffs[c11$incomediffs==1])*100)/length(c11$incomediffs))
econresponsibility<- ( (length(c11$econresponsibility[c11$econresponsibility==1])*100)/length(c11$econresponsibility))
ownershipbusiness<- ( (length(c11$ownershipbusiness[c11$ownershipbusiness==1])*100)/length(c11$ownershipbusiness))
competgood<- ( (length(c11$competgood[c11$competgood==1])*100)/length(c11$competgood))
hardwork<- ( (length(c11$hardwork[c11$hardwork==1])*100)/length(c11$hardwork))
wealthpositive<- ( (length(c11$wealthpositive[c11$wealthpositive==1])*100)/length(c11$wealthpositive))
sex<- ( (length(c11$sex[c11$sex==1])*100)/length(c11$sex))
ageyears<- ( (length(c11$ageyears[c11$ageyears==1])*100)/length(c11$ageyears))
collegedegree<- ( (length(c11$collegedegree[c11$collegedegree==1])*100)/length(c11$collegedegree))
hhincdecile<- ( (length(c11$hhincdecile[c11$hhincdecile==1])*100)/length(c11$hhincdecile))
confparties<- ( (length(c11$confparties[c11$confparties==1])*100)/length(c11$confparties))
confgov<- ( (length(c11$confgov[c11$confgov==1])*100)/length(c11$confgov))
confparliament<- ( (length(c11$confparliament[c11$confparliament==1])*100)/length(c11$confparliament))
politint<- ( (length(c11$politint[c11$politint==1])*100)/length(c11$politint))
politimp<- ( (length(c11$politimp[c11$politimp==1])*100)/length(c11$politimp))
finansat<- ( (length(c11$finansat[c11$finansat==1])*100)/length(c11$finansat))

country11<- rbind(strongleader, armyrule, expertsdecide, democpolbad, religimp, relchild, relatt, religid, godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat)


#Sweden--------------------------------
c12<-west2[which(west$country=="Sweden"),]

strongleader<- ( (length(c12$strongleader[c12$strongleader==1])*100)/length(c12$strongleader))
armyrule<- ( (length(c12$armyrule[c12$armyrule==1])*100)/length(c12$armyrule))
expertsdecide<- ( (length(c12$expertsdecide[c12$expertsdecide==1])*100)/length(c12$expertsdecide))
democpolbad<- ( (length(c12$democpolbad[c12$democpolbad==1])*100)/length(c12$democpolbad))
religimp<- ( (length(c12$religimp[c12$religimp==1])*100)/length(c12$religimp))
relchild<- ( (length(c12$relchild[c12$relchild==1])*100)/length(c12$relchild))
relatt<- ( (length(c12$relatt[c12$relatt==1])*100)/length(c12$relatt))
religid<- ( (length(c12$religid[c12$religid==1])*100)/length(c12$religid))
godimp<- ( (length(c12$godimp[c12$godimp==1])*100)/length(c12$godimp))
indepchildrev<- ( (length(c12$indepchildrev[c12$indepchildrev==1])*100)/length(c12$indepchildrev))
imagchildrev<- ( (length(c12$imagchildrev[c12$imagchildrev==1])*100)/length(c12$imagchildrev))
obedchild<- ( (length(c12$obedchild[c12$obedchild==1])*100)/length(c12$obedchild))
nototherrace<- ( (length(c12$nototherrace[c12$nototherrace==1])*100)/length(c12$nototherrace))
notimmig<- ( (length(c12$notimmig[c12$notimmig==1])*100)/length(c12$notimmig))
immigjobs<- ( (length(c12$immigjobs[c12$immigjobs==1])*100)/length(c12$immigjobs))
immigatt<- ( (length(c12$immigatt[c12$immigatt==1])*100)/length(c12$immigatt))
menbetterleaders<- ( (length(c12$menbetterleaders[c12$menbetterleaders==1])*100)/length(c12$menbetterleaders))
univboy<- ( (length(c12$univboy[c12$univboy==1])*100)/length(c12$univboy))
menrighttojobs<- ( (length(c12$menrighttojobs[c12$menrighttojobs==1])*100)/length(c12$menrighttojobs))
homosexualitynotok<- ( (length(c12$homosexualitynotok[c12$homosexualitynotok==1])*100)/length(c12$homosexualitynotok))
abortionnotok<- ( (length(c12$abortionnotok[c12$abortionnotok==1])*100)/length(c12$abortionnotok))
euthannotok<- ( (length(c12$euthannotok[c12$euthannotok==1])*100)/length(c12$euthannotok))
incomediffs<- ( (length(c12$incomediffs[c12$incomediffs==1])*100)/length(c12$incomediffs))
econresponsibility<- ( (length(c12$econresponsibility[c12$econresponsibility==1])*100)/length(c12$econresponsibility))
ownershipbusiness<- ( (length(c12$ownershipbusiness[c12$ownershipbusiness==1])*100)/length(c12$ownershipbusiness))
competgood<- ( (length(c12$competgood[c12$competgood==1])*100)/length(c12$competgood))
hardwork<- ( (length(c12$hardwork[c12$hardwork==1])*100)/length(c12$hardwork))
wealthpositive<- ( (length(c12$wealthpositive[c12$wealthpositive==1])*100)/length(c12$wealthpositive))
sex<- ( (length(c12$sex[c12$sex==1])*100)/length(c12$sex))
ageyears<- ( (length(c12$ageyears[c12$ageyears==1])*100)/length(c12$ageyears))
collegedegree<- ( (length(c12$collegedegree[c12$collegedegree==1])*100)/length(c12$collegedegree))
hhincdecile<- ( (length(c12$hhincdecile[c12$hhincdecile==1])*100)/length(c12$hhincdecile))
confparties<- ( (length(c12$confparties[c12$confparties==1])*100)/length(c12$confparties))
confgov<- ( (length(c12$confgov[c12$confgov==1])*100)/length(c12$confgov))
confparliament<- ( (length(c12$confparliament[c12$confparliament==1])*100)/length(c12$confparliament))
politint<- ( (length(c12$politint[c12$politint==1])*100)/length(c12$politint))
politimp<- ( (length(c12$politimp[c12$politimp==1])*100)/length(c12$politimp))
finansat<- ( (length(c12$finansat[c12$finansat==1])*100)/length(c12$finansat))

country12<- rbind(strongleader, armyrule, expertsdecide, democpolbad, religimp, relchild, relatt, religid, godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat)


#Switzerland--------------------------------
c13<-west2[which(west$country=="Switzerland"),]

strongleader<- ( (length(c13$strongleader[c13$strongleader==1])*100)/length(c13$strongleader))
armyrule<- ( (length(c13$armyrule[c13$armyrule==1])*100)/length(c13$armyrule))
expertsdecide<- ( (length(c13$expertsdecide[c13$expertsdecide==1])*100)/length(c13$expertsdecide))
democpolbad<- ( (length(c13$democpolbad[c13$democpolbad==1])*100)/length(c13$democpolbad))
religimp<- ( (length(c13$religimp[c13$religimp==1])*100)/length(c13$religimp))
relchild<- ( (length(c13$relchild[c13$relchild==1])*100)/length(c13$relchild))
relatt<- ( (length(c13$relatt[c13$relatt==1])*100)/length(c13$relatt))
religid<- ( (length(c13$religid[c13$religid==1])*100)/length(c13$religid))
godimp<- ( (length(c13$godimp[c13$godimp==1])*100)/length(c13$godimp))
indepchildrev<- ( (length(c13$indepchildrev[c13$indepchildrev==1])*100)/length(c13$indepchildrev))
imagchildrev<- ( (length(c13$imagchildrev[c13$imagchildrev==1])*100)/length(c13$imagchildrev))
obedchild<- ( (length(c13$obedchild[c13$obedchild==1])*100)/length(c13$obedchild))
nototherrace<- ( (length(c13$nototherrace[c13$nototherrace==1])*100)/length(c13$nototherrace))
notimmig<- ( (length(c13$notimmig[c13$notimmig==1])*100)/length(c13$notimmig))
immigjobs<- ( (length(c13$immigjobs[c13$immigjobs==1])*100)/length(c13$immigjobs))
immigatt<- ( (length(c13$immigatt[c13$immigatt==1])*100)/length(c13$immigatt))
menbetterleaders<- ( (length(c13$menbetterleaders[c13$menbetterleaders==1])*100)/length(c13$menbetterleaders))
univboy<- ( (length(c13$univboy[c13$univboy==1])*100)/length(c13$univboy))
menrighttojobs<- ( (length(c13$menrighttojobs[c13$menrighttojobs==1])*100)/length(c13$menrighttojobs))
homosexualitynotok<- ( (length(c13$homosexualitynotok[c13$homosexualitynotok==1])*100)/length(c13$homosexualitynotok))
abortionnotok<- ( (length(c13$abortionnotok[c13$abortionnotok==1])*100)/length(c13$abortionnotok))
euthannotok<- ( (length(c13$euthannotok[c13$euthannotok==1])*100)/length(c13$euthannotok))
incomediffs<- ( (length(c13$incomediffs[c13$incomediffs==1])*100)/length(c13$incomediffs))
econresponsibility<- ( (length(c13$econresponsibility[c13$econresponsibility==1])*100)/length(c13$econresponsibility))
ownershipbusiness<- ( (length(c13$ownershipbusiness[c13$ownershipbusiness==1])*100)/length(c13$ownershipbusiness))
competgood<- ( (length(c13$competgood[c13$competgood==1])*100)/length(c13$competgood))
hardwork<- ( (length(c13$hardwork[c13$hardwork==1])*100)/length(c13$hardwork))
wealthpositive<- ( (length(c13$wealthpositive[c13$wealthpositive==1])*100)/length(c13$wealthpositive))
sex<- ( (length(c13$sex[c13$sex==1])*100)/length(c13$sex))
ageyears<- ( (length(c13$ageyears[c13$ageyears==1])*100)/length(c13$ageyears))
collegedegree<- ( (length(c13$collegedegree[c13$collegedegree==1])*100)/length(c13$collegedegree))
hhincdecile<- ( (length(c13$hhincdecile[c13$hhincdecile==1])*100)/length(c13$hhincdecile))
confparties<- ( (length(c13$confparties[c13$confparties==1])*100)/length(c13$confparties))
confgov<- ( (length(c13$confgov[c13$confgov==1])*100)/length(c13$confgov))
confparliament<- ( (length(c13$confparliament[c13$confparliament==1])*100)/length(c13$confparliament))
politint<- ( (length(c13$politint[c13$politint==1])*100)/length(c13$politint))
politimp<- ( (length(c13$politimp[c13$politimp==1])*100)/length(c13$politimp))
finansat<- ( (length(c13$finansat[c13$finansat==1])*100)/length(c13$finansat))

country13<- rbind(strongleader, armyrule, expertsdecide, democpolbad, religimp, relchild, relatt, religid, godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat)


#US--------------------------------
c14<-west2[which(west$country=="United States"),]

strongleader<- ( (length(c14$strongleader[c14$strongleader==1])*100)/length(c14$strongleader))
armyrule<- ( (length(c14$armyrule[c14$armyrule==1])*100)/length(c14$armyrule))
expertsdecide<- ( (length(c14$expertsdecide[c14$expertsdecide==1])*100)/length(c14$expertsdecide))
democpolbad<- ( (length(c14$democpolbad[c14$democpolbad==1])*100)/length(c14$democpolbad))
religimp<- ( (length(c14$religimp[c14$religimp==1])*100)/length(c14$religimp))
relchild<- ( (length(c14$relchild[c14$relchild==1])*100)/length(c14$relchild))
relatt<- ( (length(c14$relatt[c14$relatt==1])*100)/length(c14$relatt))
religid<- ( (length(c14$religid[c14$religid==1])*100)/length(c14$religid))
godimp<- ( (length(c14$godimp[c14$godimp==1])*100)/length(c14$godimp))
indepchildrev<- ( (length(c14$indepchildrev[c14$indepchildrev==1])*100)/length(c14$indepchildrev))
imagchildrev<- ( (length(c14$imagchildrev[c14$imagchildrev==1])*100)/length(c14$imagchildrev))
obedchild<- ( (length(c14$obedchild[c14$obedchild==1])*100)/length(c14$obedchild))
nototherrace<- ( (length(c14$nototherrace[c14$nototherrace==1])*100)/length(c14$nototherrace))
notimmig<- ( (length(c14$notimmig[c14$notimmig==1])*100)/length(c14$notimmig))
immigjobs<- ( (length(c14$immigjobs[c14$immigjobs==1])*100)/length(c14$immigjobs))
immigatt<- ( (length(c14$immigatt[c14$immigatt==1])*100)/length(c14$immigatt))
menbetterleaders<- ( (length(c14$menbetterleaders[c14$menbetterleaders==1])*100)/length(c14$menbetterleaders))
univboy<- ( (length(c14$univboy[c14$univboy==1])*100)/length(c14$univboy))
menrighttojobs<- ( (length(c14$menrighttojobs[c14$menrighttojobs==1])*100)/length(c14$menrighttojobs))
homosexualitynotok<- ( (length(c14$homosexualitynotok[c14$homosexualitynotok==1])*100)/length(c14$homosexualitynotok))
abortionnotok<- ( (length(c14$abortionnotok[c14$abortionnotok==1])*100)/length(c14$abortionnotok))
euthannotok<- ( (length(c14$euthannotok[c14$euthannotok==1])*100)/length(c14$euthannotok))
incomediffs<- ( (length(c14$incomediffs[c14$incomediffs==1])*100)/length(c14$incomediffs))
econresponsibility<- ( (length(c14$econresponsibility[c14$econresponsibility==1])*100)/length(c14$econresponsibility))
ownershipbusiness<- ( (length(c14$ownershipbusiness[c14$ownershipbusiness==1])*100)/length(c14$ownershipbusiness))
competgood<- ( (length(c14$competgood[c14$competgood==1])*100)/length(c14$competgood))
hardwork<- ( (length(c14$hardwork[c14$hardwork==1])*100)/length(c14$hardwork))
wealthpositive<- ( (length(c14$wealthpositive[c14$wealthpositive==1])*100)/length(c14$wealthpositive))
sex<- ( (length(c14$sex[c14$sex==1])*100)/length(c14$sex))
ageyears<- ( (length(c14$ageyears[c14$ageyears==1])*100)/length(c14$ageyears))
collegedegree<- ( (length(c14$collegedegree[c14$collegedegree==1])*100)/length(c14$collegedegree))
hhincdecile<- ( (length(c14$hhincdecile[c14$hhincdecile==1])*100)/length(c14$hhincdecile))
confparties<- ( (length(c14$confparties[c14$confparties==1])*100)/length(c14$confparties))
confgov<- ( (length(c14$confgov[c14$confgov==1])*100)/length(c14$confgov))
confparliament<- ( (length(c14$confparliament[c14$confparliament==1])*100)/length(c14$confparliament))
politint<- ( (length(c14$politint[c14$politint==1])*100)/length(c14$politint))
politimp<- ( (length(c14$politimp[c14$politimp==1])*100)/length(c14$politimp))
finansat<- ( (length(c14$finansat[c14$finansat==1])*100)/length(c14$finansat))

country14<- rbind(strongleader, armyrule, expertsdecide, democpolbad, religimp, relchild, relatt, religid, godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat)



#Combine countries----------------
for_tableb2<-cbind(country1, country2, country3, country4, country5, country6, country7, country8, country9, country10, country11, country12, country13, country14)

colnames(for_tableb2)<-c("Australia", "Canada", "Finland", "France", "Germany", "Great Britain", "Italy", "Netherlands", "New Zealand", "Norway", "Spain", "Sweden", "Switzerland", "United States") 

rownames(for_tableb2)<-c("Strong Leader", "Army Rule", "Experts Decide", "Democracy", "Religious Importance", "Religious Child-Rearing", "Religious Attendance", "Religious identification", "Importance of God", "Independence Child-Rearing", "Imagination Child-Rearing", "Obedience Child-Rearing", "No Other-Race Neighbor", "No Immigrant Neighbor","Immigrant Jobs", "Immigration Attitude", "Men Better Leaders", "University for Boys Only", "Men Right to Jobs", "Homosexuality Attitude", "Abortion Attitude", "Euthanasia Attitude", "Income Inequality", "Social Welfare", "Business Ownership", "Competition is Good", "Meritocracy", "Wealth Positive", "Sex", "Age", "College Degree", "Household Income", "Confidence in Parties", "Confidence in Government", "Confidence in Parliament", "Political Interest", "Political Importance", "Financial Satisfaction")

stargazer(for_tableb2,type="html", title="Table B-2: Percentage of Respondents with data for each item across WVS countries", digits=1, font.size = "tiny", out="Table_B2.doc")



#Table B-3 in SOM - Percentage of respondents with data on each item in lapop surveys


abus$data<-"US2017"
abcan$data<-"Canada2017"
abus19$data<-"US2019"

latin<-full_join(abus, abus19)
latin<-full_join(latin, abcan)

latin1 <- latin %>%
  mutate(closecongress = 1-as.numeric(is.na(closecongress)))  %>% 
  mutate(closeparliament = 1-as.numeric(is.na(closeparliament))) %>% 
  mutate(closeinstit = 1-as.numeric(is.na(closeinstit))) %>% 
  mutate(coup = 1-as.numeric(is.na(coup))) %>% 
  mutate(churchillrev = 1-as.numeric(is.na(churchillrev))) %>% 
  mutate(disallowvote = 1-as.numeric(is.na(disallowvote))) %>% 
  mutate(disallowdemonstration = 1-as.numeric(is.na(disallowdemonstration))) %>% 
  mutate(disallowrunforoffice = 1-as.numeric(is.na(disallowrunforoffice))) %>% 
  mutate(disallowspeeches = 1-as.numeric(is.na(disallowspeeches))) %>% 
  mutate(toomuchpressfreedombinary = 1-as.numeric(is.na(toomuchpressfreedombinary))) %>% 
  mutate(toomuchexpressionfreedombinary = 1-as.numeric(is.na(toomuchexpressionfreedombinary))) %>% 
  mutate(toomuchpolitfreedombinary = 1-as.numeric(is.na(toomuchpolitfreedombinary))) %>% 
  mutate(limitopp = 1-as.numeric(is.na(limitopp))) %>% 
  mutate(democnotpref = 1-as.numeric(is.na(democnotpref))) %>% 
  mutate(religattend = 1-as.numeric(is.na(religattend))) %>% 
  mutate(religimport = 1-as.numeric(is.na(religimport))) %>% 
  mutate(againstsamesexmarriage = 1-as.numeric(is.na(againstsamesexmarriage))) %>% 
  mutate(punishcriminals = 1-as.numeric(is.na(punishcriminals))) %>% 
  mutate(menbetterleaders = 1-as.numeric(is.na(menbetterleaders))) %>% 
  mutate(ownindustry = 1-as.numeric(is.na(ownindustry))) %>% 
  mutate(incomeineq = 1-as.numeric(is.na(incomeineq))) %>% 
  mutate(helppoor = 1-as.numeric(is.na(helppoor))) %>% 
  mutate(richtax = 1-as.numeric(is.na(richtax))) %>% 
  mutate(unemp = 1-as.numeric(is.na(unemp))) %>% 
  mutate(sex = 1-as.numeric(is.na(sex))) %>% 
  mutate(ageyears = 1-as.numeric(is.na(ageyears))) %>% 
  mutate(collegedegree = 1-as.numeric(is.na(collegedegree))) %>% 
  mutate(hhincome = 1-as.numeric(is.na(hhincome))) %>% 
  mutate(blackvsall = 1-as.numeric(is.na(blackvsall))) %>% 
  mutate(latinovsall = 1-as.numeric(is.na(latinovsall))) %>% 
  mutate(asianvsall = 1-as.numeric(is.na(asianvsall))) %>% 
  mutate(nativeamvsall = 1-as.numeric(is.na(nativeamvsall))) %>% 
  mutate(middleeastvsall = 1-as.numeric(is.na(middleeastvsall))) %>% 
  mutate(mixedvsall = 1-as.numeric(is.na(mixedvsall))) %>% 
  mutate(othervsall = 1-as.numeric(is.na(othervsall))) %>% 
  mutate(trustelections = 1-as.numeric(is.na(trustelections))) %>% 
  mutate(trustparties = 1-as.numeric(is.na(trustparties))) %>% 
  mutate(trustcongress = 1-as.numeric(is.na(trustcongress))) %>% 
  mutate(trustparliament = 1-as.numeric(is.na(trustparliament))) %>% 
  mutate(trustlocalgov = 1-as.numeric(is.na(trustlocalgov))) %>% 
  mutate(polint = 1-as.numeric(is.na(polint))) %>% 
  mutate(follownews = 1-as.numeric(is.na(follownews))) %>% 
  mutate(satisdemoc = 1-as.numeric(is.na(satisdemoc)))

#US 2017  -----------------------
wave<-latin1[which(latin1$data=="US2017"),]

closecongress<- ( (length(wave$closecongress[wave$closecongress==1])*100)/length(wave$closecongress))
closeparliament<- ( (length(wave$closeparliament[wave$closeparliament==1])*100)/length(wave$closeparliament))
closeinstit<- ( (length(wave$closeinstit[wave$closeinstit==1])*100)/length(wave$closeinstit))
coup<- ( (length(wave$coup[wave$coup==1])*100)/length(wave$coup))
churchillrev<- ( (length(wave$churchillrev[wave$churchillrev==1])*100)/length(wave$churchillrev))
disallowvote<- ( (length(wave$disallowvote[wave$disallowvote==1])*100)/length(wave$disallowvote))
disallowdemonstration<- ( (length(wave$disallowdemonstration[wave$disallowdemonstration==1])*100)/length(wave$disallowdemonstration))
disallowrunforoffice<- ( (length(wave$disallowrunforoffice[wave$disallowrunforoffice==1])*100)/length(wave$disallowrunforoffice))
disallowspeeches<- ( (length(wave$disallowspeeches[wave$disallowspeeches==1])*100)/length(wave$disallowspeeches))
toomuchpressfreedombinary<- ( (length(wave$toomuchpressfreedombinary[wave$toomuchpressfreedombinary==1])*100)/length(wave$toomuchpressfreedombinary))
toomuchexpressionfreedombinary<- ( (length(wave$toomuchexpressionfreedombinary[wave$toomuchexpressionfreedombinary==1])*100)/length(wave$toomuchexpressionfreedombinary))
toomuchpolitfreedombinary<- ( (length(wave$toomuchpolitfreedombinary[wave$toomuchpolitfreedombinary==1])*100)/length(wave$toomuchpolitfreedombinary))
limitopp<- ( (length(wave$limitopp[wave$limitopp==1])*100)/length(wave$limitopp))
democnotpref<- ( (length(wave$democnotpref[wave$democnotpref==1])*100)/length(wave$democnotpref))
religattend<- ( (length(wave$religattend[wave$religattend==1])*100)/length(wave$religattend))
religimport<- ( (length(wave$religimport[wave$religimport==1])*100)/length(wave$religimport))
againstsamesexmarriage<- ( (length(wave$againstsamesexmarriage[wave$againstsamesexmarriage==1])*100)/length(wave$againstsamesexmarriage))
punishcriminals<- ( (length(wave$punishcriminals[wave$punishcriminals==1])*100)/length(wave$punishcriminals))
menbetterleaders<- ( (length(wave$menbetterleaders[wave$menbetterleaders==1])*100)/length(wave$menbetterleaders))
ownindustry<- ( (length(wave$ownindustry[wave$ownindustry==1])*100)/length(wave$ownindustry))
incomeineq<- ( (length(wave$incomeineq[wave$incomeineq==1])*100)/length(wave$incomeineq))
helppoor<- ( (length(wave$helppoor[wave$helppoor==1])*100)/length(wave$helppoor))
richtax<- ( (length(wave$richtax[wave$richtax==1])*100)/length(wave$richtax))
unemp<- ( (length(wave$unemp[wave$unemp==1])*100)/length(wave$unemp))
sex<- ( (length(wave$sex[wave$sex==1])*100)/length(wave$sex))
ageyears<- ( (length(wave$ageyears[wave$ageyears==1])*100)/length(wave$ageyears))
collegedegree<- ( (length(wave$collegedegree[wave$collegedegree==1])*100)/length(wave$collegedegree))
hhincome<- ( (length(wave$hhincome[wave$hhincome==1])*100)/length(wave$hhincome))
blackvsall<- ( (length(wave$blackvsall[wave$blackvsall==1])*100)/length(wave$blackvsall))
latinovsall<- ( (length(wave$latinovsall[wave$latinovsall==1])*100)/length(wave$latinovsall))
asianvsall<- ( (length(wave$asianvsall[wave$asianvsall==1])*100)/length(wave$asianvsall))
nativeamvsall<- ( (length(wave$nativeamvsall[wave$nativeamvsall==1])*100)/length(wave$nativeamvsall))
middleeastvsall<- ( (length(wave$middleeastvsall[wave$middleeastvsall==1])*100)/length(wave$middleeastvsall))
mixedvsall<- ( (length(wave$mixedvsall[wave$mixedvsall==1])*100)/length(wave$mixedvsall))
othervsall<- ( (length(wave$othervsall[wave$othervsall==1])*100)/length(wave$othervsall))
trustelections<- ( (length(wave$trustelections[wave$trustelections==1])*100)/length(wave$trustelections))
trustparties<- ( (length(wave$trustparties[wave$trustparties==1])*100)/length(wave$trustparties))
trustcongress <- ( (length(wave$trustcongress[wave$trustcongress==1])*100)/length(wave$trustcongress))
trustparliament<- ( (length(wave$trustparliament[wave$trustparliament==1])*100)/length(wave$trustparliament))
trustlocalgov<- ( (length(wave$trustlocalgov[wave$trustlocalgov==1])*100)/length(wave$trustlocalgov))
polint<- ( (length(wave$polint[wave$polint==1])*100)/length(wave$polint))
follownews<- ( (length(wave$follownews[wave$follownews==1])*100)/length(wave$follownews))
satisdemoc<- ( (length(wave$satisdemoc[wave$satisdemoc==1])*100)/length(wave$satisdemoc))

us17<- rbind(closecongress, closeparliament, closeinstit, coup, churchillrev, disallowvote, disallowdemonstration, disallowrunforoffice, disallowspeeches, toomuchpressfreedombinary, toomuchexpressionfreedombinary, toomuchpolitfreedombinary, limitopp, democnotpref, religattend, religimport, againstsamesexmarriage, punishcriminals, menbetterleaders, ownindustry, incomeineq, helppoor, richtax, unemp, sex, ageyears, collegedegree, hhincome, blackvsall, latinovsall, asianvsall, nativeamvsall, middleeastvsall, mixedvsall, othervsall, trustelections, trustparties, trustcongress, trustparliament, trustlocalgov, polint, follownews, satisdemoc)


#Canada 2017--------------------------------------  
wave<-latin1[which(latin1$data=="Canada2017"),]

closecongress<- ( (length(wave$closecongress[wave$closecongress==1])*100)/length(wave$closecongress))
closeparliament<- ( (length(wave$closeparliament[wave$closeparliament==1])*100)/length(wave$closeparliament))
closeinstit<- ( (length(wave$closeinstit[wave$closeinstit==1])*100)/length(wave$closeinstit))
coup<- ( (length(wave$coup[wave$coup==1])*100)/length(wave$coup))
churchillrev<- ( (length(wave$churchillrev[wave$churchillrev==1])*100)/length(wave$churchillrev))
disallowvote<- ( (length(wave$disallowvote[wave$disallowvote==1])*100)/length(wave$disallowvote))
disallowdemonstration<- ( (length(wave$disallowdemonstration[wave$disallowdemonstration==1])*100)/length(wave$disallowdemonstration))
disallowrunforoffice<- ( (length(wave$disallowrunforoffice[wave$disallowrunforoffice==1])*100)/length(wave$disallowrunforoffice))
disallowspeeches<- ( (length(wave$disallowspeeches[wave$disallowspeeches==1])*100)/length(wave$disallowspeeches))
toomuchpressfreedombinary<- ( (length(wave$toomuchpressfreedombinary[wave$toomuchpressfreedombinary==1])*100)/length(wave$toomuchpressfreedombinary))
toomuchexpressionfreedombinary<- ( (length(wave$toomuchexpressionfreedombinary[wave$toomuchexpressionfreedombinary==1])*100)/length(wave$toomuchexpressionfreedombinary))
toomuchpolitfreedombinary<- ( (length(wave$toomuchpolitfreedombinary[wave$toomuchpolitfreedombinary==1])*100)/length(wave$toomuchpolitfreedombinary))
limitopp<- ( (length(wave$limitopp[wave$limitopp==1])*100)/length(wave$limitopp))
democnotpref<- ( (length(wave$democnotpref[wave$democnotpref==1])*100)/length(wave$democnotpref))
religattend<- ( (length(wave$religattend[wave$religattend==1])*100)/length(wave$religattend))
religimport<- ( (length(wave$religimport[wave$religimport==1])*100)/length(wave$religimport))
againstsamesexmarriage<- ( (length(wave$againstsamesexmarriage[wave$againstsamesexmarriage==1])*100)/length(wave$againstsamesexmarriage))
punishcriminals<- ( (length(wave$punishcriminals[wave$punishcriminals==1])*100)/length(wave$punishcriminals))
menbetterleaders<- ( (length(wave$menbetterleaders[wave$menbetterleaders==1])*100)/length(wave$menbetterleaders))
ownindustry<- ( (length(wave$ownindustry[wave$ownindustry==1])*100)/length(wave$ownindustry))
incomeineq<- ( (length(wave$incomeineq[wave$incomeineq==1])*100)/length(wave$incomeineq))
helppoor<- ( (length(wave$helppoor[wave$helppoor==1])*100)/length(wave$helppoor))
richtax<- ( (length(wave$richtax[wave$richtax==1])*100)/length(wave$richtax))
unemp<- ( (length(wave$unemp[wave$unemp==1])*100)/length(wave$unemp))
sex<- ( (length(wave$sex[wave$sex==1])*100)/length(wave$sex))
ageyears<- ( (length(wave$ageyears[wave$ageyears==1])*100)/length(wave$ageyears))
collegedegree<- ( (length(wave$collegedegree[wave$collegedegree==1])*100)/length(wave$collegedegree))
hhincome<- ( (length(wave$hhincome[wave$hhincome==1])*100)/length(wave$hhincome))
blackvsall<- ( (length(wave$blackvsall[wave$blackvsall==1])*100)/length(wave$blackvsall))
latinovsall<- ( (length(wave$latinovsall[wave$latinovsall==1])*100)/length(wave$latinovsall))
asianvsall<- ( (length(wave$asianvsall[wave$asianvsall==1])*100)/length(wave$asianvsall))
nativeamvsall<- ( (length(wave$nativeamvsall[wave$nativeamvsall==1])*100)/length(wave$nativeamvsall))
middleeastvsall<- ( (length(wave$middleeastvsall[wave$middleeastvsall==1])*100)/length(wave$middleeastvsall))
mixedvsall<- ( (length(wave$mixedvsall[wave$mixedvsall==1])*100)/length(wave$mixedvsall))
othervsall<- ( (length(wave$othervsall[wave$othervsall==1])*100)/length(wave$othervsall))
trustelections<- ( (length(wave$trustelections[wave$trustelections==1])*100)/length(wave$trustelections))
trustparties<- ( (length(wave$trustparties[wave$trustparties==1])*100)/length(wave$trustparties))
trustcongress <- ( (length(wave$trustcongress[wave$trustcongress==1])*100)/length(wave$trustcongress))
trustparliament<- ( (length(wave$trustparliament[wave$trustparliament==1])*100)/length(wave$trustparliament))
trustlocalgov<- ( (length(wave$trustlocalgov[wave$trustlocalgov==1])*100)/length(wave$trustlocalgov))
polint<- ( (length(wave$polint[wave$polint==1])*100)/length(wave$polint))
follownews<- ( (length(wave$follownews[wave$follownews==1])*100)/length(wave$follownews))
satisdemoc<- ( (length(wave$satisdemoc[wave$satisdemoc==1])*100)/length(wave$satisdemoc))

can17<- rbind(closecongress, closeparliament, closeinstit, coup, churchillrev, disallowvote, disallowdemonstration, disallowrunforoffice, disallowspeeches, toomuchpressfreedombinary, toomuchexpressionfreedombinary, toomuchpolitfreedombinary, limitopp, democnotpref, religattend, religimport, againstsamesexmarriage, punishcriminals, menbetterleaders, ownindustry, incomeineq, helppoor, richtax, unemp, sex, ageyears, collegedegree, hhincome, blackvsall, latinovsall, asianvsall, nativeamvsall, middleeastvsall, mixedvsall, othervsall, trustelections, trustparties, trustcongress, trustparliament, trustlocalgov, polint, follownews, satisdemoc)

#US 2019  -----------------------
wave<-latin1[which(latin1$data=="US2019"),]

closecongress<- ( (length(wave$closecongress[wave$closecongress==1])*100)/length(wave$closecongress))
closeparliament<- ( (length(wave$closeparliament[wave$closeparliament==1])*100)/length(wave$closeparliament))
closeinstit<- ( (length(wave$closeinstit[wave$closeinstit==1])*100)/length(wave$closeinstit))
coup<- ( (length(wave$coup[wave$coup==1])*100)/length(wave$coup))
churchillrev<- ( (length(wave$churchillrev[wave$churchillrev==1])*100)/length(wave$churchillrev))
disallowvote<- ( (length(wave$disallowvote[wave$disallowvote==1])*100)/length(wave$disallowvote))
disallowdemonstration<- ( (length(wave$disallowdemonstration[wave$disallowdemonstration==1])*100)/length(wave$disallowdemonstration))
disallowrunforoffice<- ( (length(wave$disallowrunforoffice[wave$disallowrunforoffice==1])*100)/length(wave$disallowrunforoffice))
disallowspeeches<- ( (length(wave$disallowspeeches[wave$disallowspeeches==1])*100)/length(wave$disallowspeeches))
toomuchpressfreedombinary<- ( (length(wave$toomuchpressfreedombinary[wave$toomuchpressfreedombinary==1])*100)/length(wave$toomuchpressfreedombinary))
toomuchexpressionfreedombinary<- ( (length(wave$toomuchexpressionfreedombinary[wave$toomuchexpressionfreedombinary==1])*100)/length(wave$toomuchexpressionfreedombinary))
toomuchpolitfreedombinary<- ( (length(wave$toomuchpolitfreedombinary[wave$toomuchpolitfreedombinary==1])*100)/length(wave$toomuchpolitfreedombinary))
limitopp<- ( (length(wave$limitopp[wave$limitopp==1])*100)/length(wave$limitopp))
democnotpref<- ( (length(wave$democnotpref[wave$democnotpref==1])*100)/length(wave$democnotpref))
religattend<- ( (length(wave$religattend[wave$religattend==1])*100)/length(wave$religattend))
religimport<- ( (length(wave$religimport[wave$religimport==1])*100)/length(wave$religimport))
againstsamesexmarriage<- ( (length(wave$againstsamesexmarriage[wave$againstsamesexmarriage==1])*100)/length(wave$againstsamesexmarriage))
punishcriminals<- ( (length(wave$punishcriminals[wave$punishcriminals==1])*100)/length(wave$punishcriminals))
menbetterleaders<- ( (length(wave$menbetterleaders[wave$menbetterleaders==1])*100)/length(wave$menbetterleaders))
ownindustry<- ( (length(wave$ownindustry[wave$ownindustry==1])*100)/length(wave$ownindustry))
incomeineq<- ( (length(wave$incomeineq[wave$incomeineq==1])*100)/length(wave$incomeineq))
helppoor<- ( (length(wave$helppoor[wave$helppoor==1])*100)/length(wave$helppoor))
richtax<- ( (length(wave$richtax[wave$richtax==1])*100)/length(wave$richtax))
unemp<- ( (length(wave$unemp[wave$unemp==1])*100)/length(wave$unemp))
sex<- ( (length(wave$sex[wave$sex==1])*100)/length(wave$sex))
ageyears<- ( (length(wave$ageyears[wave$ageyears==1])*100)/length(wave$ageyears))
collegedegree<- ( (length(wave$collegedegree[wave$collegedegree==1])*100)/length(wave$collegedegree))
hhincome<- ( (length(wave$hhincome[wave$hhincome==1])*100)/length(wave$hhincome))
blackvsall<- ( (length(wave$blackvsall[wave$blackvsall==1])*100)/length(wave$blackvsall))
latinovsall<- ( (length(wave$latinovsall[wave$latinovsall==1])*100)/length(wave$latinovsall))
asianvsall<- ( (length(wave$asianvsall[wave$asianvsall==1])*100)/length(wave$asianvsall))
nativeamvsall<- ( (length(wave$nativeamvsall[wave$nativeamvsall==1])*100)/length(wave$nativeamvsall))
middleeastvsall<- ( (length(wave$middleeastvsall[wave$middleeastvsall==1])*100)/length(wave$middleeastvsall))
mixedvsall<- ( (length(wave$mixedvsall[wave$mixedvsall==1])*100)/length(wave$mixedvsall))
othervsall<- ( (length(wave$othervsall[wave$othervsall==1])*100)/length(wave$othervsall))
trustelections<- ( (length(wave$trustelections[wave$trustelections==1])*100)/length(wave$trustelections))
trustparties<- ( (length(wave$trustparties[wave$trustparties==1])*100)/length(wave$trustparties))
trustcongress <- ( (length(wave$trustcongress[wave$trustcongress==1])*100)/length(wave$trustcongress))
trustparliament<- ( (length(wave$trustparliament[wave$trustparliament==1])*100)/length(wave$trustparliament))
trustlocalgov<- ( (length(wave$trustlocalgov[wave$trustlocalgov==1])*100)/length(wave$trustlocalgov))
polint<- ( (length(wave$polint[wave$polint==1])*100)/length(wave$polint))
follownews<- ( (length(wave$follownews[wave$follownews==1])*100)/length(wave$follownews))
satisdemoc<- ( (length(wave$satisdemoc[wave$satisdemoc==1])*100)/length(wave$satisdemoc))

us19<- rbind(closecongress, closeparliament, closeinstit, coup, churchillrev, disallowvote, disallowdemonstration, disallowrunforoffice, disallowspeeches, toomuchpressfreedombinary, toomuchexpressionfreedombinary, toomuchpolitfreedombinary, limitopp, democnotpref, religattend, religimport, againstsamesexmarriage, punishcriminals, menbetterleaders, ownindustry, incomeineq, helppoor, richtax, unemp, sex, ageyears, collegedegree, hhincome, blackvsall, latinovsall, asianvsall, nativeamvsall, middleeastvsall, mixedvsall, othervsall, trustelections, trustparties, trustcongress, trustparliament, trustlocalgov, polint, follownews, satisdemoc)

#Make Table B-3-----------------
for_tableb3<-cbind(us17, can17, us19) #bind data

colnames(for_tableb3)<-c("U.S.-2017", "Canada-2017", "U.S.-2019") 
rownames(for_tableb3)<-c("Close Congress", "Close Parliament", "Close Institutions", "Coup", "Churchill Item", "Disallow Vote", "Disallow Demonstration", "Disallow Run for Office", "Disallow Speeches", "Press Freedom", "Expression Freedom", "Political Freedom", "Limit Opposition", "Democracy Not Preferable", "Religious Attendance", "Religious Importance", "Against Same-Sex Marriage", "Punish Criminals", "Men Better Leaders", "Industry Ownership", "Income Inequality", "Government Help Poor", "Tax Rich", "Unemployment Belief", "Sex", "Age", "College Degree", "Household Income", "Black vs. All", "Latino vs. All", "Asian vs. All", "Native American vs. All", "Middle Eastern vs. All", "Mixed Race vs. All", "Other Race vs. All", "Trust Elections", "Trust Parties", "Trust Congress", "Trust Parliament", "Trust Local Government", "Political Interest", "Follow News", "Satisfaction with Democracy")

stargazer(for_tableb3,type="html", title="Table B-3: Percentage of respondents with data for each item across the LAPOP surveys", digits=1, font.size = "tiny", out="Table_B3.doc")





